You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2020/07/20 10:10:38 UTC

[GitHub] [hive] dengzhhu653 commented on a change in pull request #1242: HIVE-20441: NPE in GenericUDF when hive.allow.udf.load.on.demand is s…

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/master/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/master/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.




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org