thomasrebele commented on code in PR #6352:
URL: https://github.com/apache/hive/pull/6352#discussion_r2903827281


##########
ql/src/java/org/apache/hadoop/hive/ql/plan/ExprNodeGenericFuncDesc.java:
##########
@@ -94,7 +94,7 @@ public ExprNodeGenericFuncDesc(ObjectInspector oi, GenericUDF 
genericUDF,
         ObjectInspectorUtils.getWritableObjectInspector(oi);
     assert (genericUDF != null);
     this.genericUDF = genericUDF;
-    this.children = children;
+    this.children = children == null ? new ArrayList<>() : new 
ArrayList<>(children);

Review Comment:
   It is safer to avoid `null` for `children`, as there are several places 
without `null` check, e.g., in 
[getExprString](https://github.com/apache/hive/blob/f301a6c6042f1ff1c4d1d611bd9b8317a8c6a429/ql/src/java/org/apache/hadoop/hive/ql/plan/ExprNodeGenericFuncDesc.java#L165).
 The children are exposed to other classes by `getChildren()`, so it's simpler 
to just use an empty list instead of adding null checks everywhere.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to