dengzhhu653 commented on a change in pull request #1242:
URL: https://github.com/apache/hive/pull/1242#discussion_r457248607
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/Registry.java
##########
@@ -293,9 +293,10 @@ public FunctionInfo registerPermanentFunction(String
functionName,
if (registerToSession) {
String qualifiedName = FunctionUtils.qualifyFunctionName(
functionName, SessionState.get().getCurrentDatabase().toLowerCase());
- if (registerToSessionRegistry(qualifiedName, function) != null) {
+ FunctionInfo newFunction = registerToSessionRegistry(qualifiedName,
function);
Review comment:
The call ```FunctionRegistry.getFunctionInfo(String functionName)```
will make HS2 will lookup the function from MetaStore when the function does
not find in the session or system registry with hive.allow.udf.load.on.demand
enabled. If the function is found, a FunctionInfo created by ```new
FunctionInfo(functionName, className, resources)``` will be returned, but the
genericUDF field of the FunctionInfo is null,
https://github.com/apache/hive/blob/fa086ecce543384993a61d5154b14fa3b80df3b5/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionInfo.java#L67-L74
.
So when TypeCheckProcFactory.DefaultExprProcessor gets function expr from
AstNode,
https://github.com/apache/hive/blob/fa086ecce543384993a61d5154b14fa3b80df3b5/ql/src/java/org/apache/hadoop/hive/ql/parse/type/TypeCheckProcFactory.java#L935-L948,
The genericUDF got from ```GenericUDF genericUDF = fi.getGenericUDF();``` is
null, if the genericUDF is used to create function expr desc afterwards, a npe
will be thrown.
https://github.com/apache/hive/blob/fa086ecce543384993a61d5154b14fa3b80df3b5/ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionInfo.java#L117-L123
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]