I read documentation, but have some questions: 1) What is the real difference between UDF and just creating function in sql? I mean the speed of execution. 2) If I create a function, is it implicitly C? I am asking because there is python binding also. 3) If I have already installed Monetdb and want to create UDF, should I recompile whole monetdb? I am not good enough yet to do something like this. I am asking, because I want to take a text type column full of 0s and 1s ("110101010"), represent it as a "int" or "bit" and do bitwise AND against other columns. When I am saying represent as int/bit, I mean not to change ("110101010") into bit, just let C know that it should interpret that number already as int or bit.
Hey Shmagi, 1) UDFs are more flexible than functions written in SQL, and give you much more fine grained control of the data. They can potentially be much faster than functions written in SQL, although that depends on what exactly you are trying to do and how exactly you have implemented it. 2) The current release version of MonetDB supports UDFs in the languages C and R. You can write UDFs in Python if you compile an in-development version of MonetDB as detailed on the MonetDB blog, here https://www.monetdb.org/blog/embedded-pythonnumpy-monetdb. 3) If you want to create a UDF written in C you do not need to recompile MonetDB entirely, but you do need to compile your UDF and add the compiled library and the .mal and .sql files that detail how to link to your function to the MonetDB library directory. The documentation for how to that exactly can be found here https://www.monetdb.org/Documentation/Cookbooks/SQLrecipes/UserDefinedFuncti.... It is an in-depth process that requires you to understand how MonetDB works internally. It might be easier to write an R UDF, or to compile the in-development version of MonetDB and write a Python UDF, as these do not require you to compile or link anything. I hope that answers your questions. If you have any more let me know. Mark
Thanks for the answer. I opened new thread about why I want function.
https://www.monetdb.org/pipermail/users-list/2016-March/008916.html
On Sun, Mar 13, 2016 at 1:11 PM, Mark Raasveldt
Hey Shmagi,
1) UDFs are more flexible than functions written in SQL, and give you much more fine grained control of the data. They can potentially be much faster than functions written in SQL, although that depends on what exactly you are trying to do and how exactly you have implemented it. 2) The current release version of MonetDB supports UDFs in the languages C and R. You can write UDFs in Python if you compile an in-development version of MonetDB as detailed on the MonetDB blog, here https://www.monetdb.org/blog/embedded-pythonnumpy-monetdb. 3) If you want to create a UDF written in C you do not need to recompile MonetDB entirely, but you do need to compile your UDF and add the compiled library and the .mal and .sql files that detail how to link to your function to the MonetDB library directory. The documentation for how to that exactly can be found here https://www.monetdb.org/Documentation/Cookbooks/SQLrecipes/UserDefinedFuncti.... It is an in-depth process that requires you to understand how MonetDB works internally. It might be easier to write an R UDF, or to compile the in-development version of MonetDB and write a Python UDF, as these do not require you to compile or link anything.
I hope that answers your questions. If you have any more let me know.
Mark
_______________________________________________ users-list mailing list users-list@monetdb.org https://www.monetdb.org/mailman/listinfo/users-list
participants (2)
-
Mark Raasveldt
-
Shmagi Kavtaradze