Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

How to make JAR files in HDFS available for custom UDF without manually adding each time?

How to make JAR files in HDFS available for custom UDF without manually adding each time?

Contributor

I have a custom UDF that I have created on several databases in Hive by using the following command through beeline.

add JAR hdfs:///my/jar/location/myjar.jar;

create function my_schema.myFunction as 'com.class.path.hive.MyFunction' using JAR 'hdfs:////my/jar/location/myjar.jar';

However, if a user then tries to use this UDF on any of the schemas I have created it on, it sometimes does not work and they receive a 'Invalid Function' error. However, it does work on some schemas, and then automatically adds the JAR to the classpath. After it works, they can then go back to the schema that it previously did not work on and use it without any issues. Why is this JAR only being added to the classpath sometimes?

Don't have an account?
Coming from Hortonworks? Activate your account here