User Defined Functions in Presto

user3339340 picture user3339340 · May 27, 2015 · Viewed 10.3k times · Source

I am currently working with Presto 0.80. I have to write a user defined function to convert degree celsius to degree fahrenheit during select query. I did the same using Hive QL but was wondering if we can replicate the same in Facebook Presto.

Any help would be highly appreciated.

Thanks!!

Answer

袁安峰 picture 袁安峰 · Jun 17, 2015

Here is a guide for writing a new function in presto. https://prestosql.io/docs/current/develop/functions.html

After writing your function, add the plugin to the plugin directory as explained in SPI Overview.

There is another example for writing presto UDF from Qubole blog. http://www.qubole.com/blog/product/plugging-in-presto-udfs/ You can try it if you can make it work.