[ https://issues.apache.org/jira/browse/HIVE-12217?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michał Warecki updated HIVE-12217: ---------------------------------- Description: 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: {code:title=FunctionInfo.java} 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; } {code} 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: {code:title=FunctionInfo.java} if(className != null) { return Class.forName(className); } {code} return null; was: 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: {code:title=FunctionInfo.java} 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; } {code} 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; > 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: > {code:title=FunctionInfo.java} > 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; > } > {code} > 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: > {code:title=FunctionInfo.java} > if(className != null) { > return Class.forName(className); > } > {code} > return null; -- This message was sent by Atlassian JIRA (v6.3.4#6332)