Supported user defined functions

Unified Analytics supports user defined functions in both SQL engines. You learn which types of UDFs are supported and see usage examples.

You can use the following types of UDFs:
  • Hive Java UDF
    create function hive_f(int) returns int LOCATION
    S3a://my-bucket/path.jar SYMBOL='my_java_func'
  • Native C++ UDFs created in Impala
    create function native_fn(int) returns
    int LOCATION S3a://my-bucket/path.so SYMBOL='my_cpp_func'
  • Native C++ UDAs created in Impala
    create aggregate function agg_fn(int)
    returns int LOCATION S3a://my-bucket/path.so SYMBOL='agg_func'
After creating the C++ functions, you must run RELOAD FUNCTION or RELOAD FUNCTIONS to load UDFs you created from Impala into HiveServer (HS2). For example:
RELOAD FUNCTIONS
For example:
select native_fn(i1) from tbl1;
| _c0  |
3 
3 
  
select agg_fn(i1) from tbl1;
| _c0  |
2 

select hive_f(s1) from tbl1;
| _c0  |
119 
104