Michał Warecki created HIVE-12217:
-------------------------------------
Summary: FunctionInfo#getFunctionClass should not return null for
persistent functions
Key: HIVE-12217
URL: https://issues.apache.org/jira/browse/HIVE-12217
Project: Hive
Issue Type: Bug
Components: Hive
Affects Versions: 1.2.1
Environment: ALL
Reporter: Michał Warecki
For persistent UDF functions #className attribute is being stored in
FunctionInfo class instance.
When you try to fetch function class using #getFunctionClass method, then null
is being returned:
public Class<?> getFunctionClass() {
if (isGenericUDF()) {
if (genericUDF instanceof GenericUDFBridge) {
return ((GenericUDFBridge) genericUDF).getUdfClass();
} else {
return genericUDF.getClass();
}
} else if (isGenericUDAF()) {
if (genericUDAFResolver instanceof GenericUDAFBridge) {
return ((GenericUDAFBridge) genericUDAFResolver).getUDAFClass();
} else {
return genericUDAFResolver.getClass();
}
} else if (isGenericUDTF()) {
return genericUDTF.getClass();
}
if(isTableFunction()) {
return this.tableFunctionResolver;
}
return null;
}
This causes NPE being thrown in Apache Spark when it lookups for Hive UDF.
I think it should return #className if none of the conditions are met so
something like that:
if(className != null) {
return Class.forName(className);
}
return null;
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)