Hi all,
I'm having issues getting a UDF to work. I've followed the instructions and 
created a jar, and I've created a function with the CREATE FUNCTION command. 
However, when I use the function in a SELECT statement, I get a 
ClassNotFoundException for the custom class I wrote. I'm using v4.4.0.

Here's some debugging information:1. The UDF jar includes the dependency jars 
(phoenix-core, hbase, hadoop-common, etc.), in addition to the UDF class 
itself. There are no permission issues with the jar.
2. I've tried putting the jar on the local FS, on my custom DFS, and also in 
the HBase dynamic jar dir (as specified in hbase-site.xml).3. I've tried the 
CREATE FUNCTION command without giving the jar path (the jar is present in the 
HBase dynamic jar dir).
4. The Phoenix client doesn't report any syntax errors with my CREATE FUNCTION 
command I'm using:create function GetValue(VARBINARY) returns UNSIGNED_LONG as 
'org.apache.phoenix.expression.function.GetValue' using jar 'path_to_jar';
5. Here's part of the stack trace for the query SELECT GetValue(pk) FROM 
"table_name"; (full stack trace here)

Error: java.lang.reflect.InvocationTargetException (state=,code=0)
...
Caused by: java.lang.ClassNotFoundException: 
org.apache.phoenix.expression.function.GetValue
    at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
    at 
org.apache.hadoop.hbase.util.DynamicClassLoader.loadClass(DynamicClassLoader.java:147)
    at 
org.apache.phoenix.expression.function.UDFExpression.constructUDFFunction(UDFExpression.java:164)
    ... 28 more

Am I missing something? I've studied the UDF documentation and searched around 
for my issue but to no avail. The GetValue class is present in the UDF jar, so 
I'm not sure what the root problem is. I would greatly appreciate any help!

Thanks,Anchal

Reply via email to