-
Notifications
You must be signed in to change notification settings - Fork 4.8k
HIVE-29488: KryoException: NullPointerException: Cannot invoke "java.util.Collection.isEmpty()" because "this.delegate" is null #6352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -75,6 +75,12 @@ public class ExprNodeGenericFuncDesc extends ExprNodeDesc implements | |
| public ExprNodeGenericFuncDesc() {; | ||
| } | ||
|
|
||
| /** | ||
| * Constructor. | ||
| * | ||
| * @param children the children; a copy is made, so later changes to the passed list | ||
| * do not affect the children of this instance | ||
| */ | ||
| /* If the function has an explicit name like func(args) then call a | ||
| * constructor that explicitly provides the function name in the | ||
| * funcText argument. | ||
|
|
@@ -86,6 +92,12 @@ public ExprNodeGenericFuncDesc(TypeInfo typeInfo, GenericUDF genericUDF, | |
| genericUDF, funcText, children); | ||
| } | ||
|
|
||
| /** | ||
| * Constructor. | ||
| * | ||
| * @param children the children; a copy is made, so later changes to the passed list | ||
| * do not affect the children of this instance | ||
| */ | ||
| public ExprNodeGenericFuncDesc(ObjectInspector oi, GenericUDF genericUDF, | ||
| String funcText, | ||
| List<ExprNodeDesc> children) { | ||
|
|
@@ -94,16 +106,28 @@ 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); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why you need a
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ayushtkn if we don't explicitly convert it to ArrayList, kryo cannot determine the actual runtime List object for ExprNodeGenericFuncDesc.children and uses AbstractMapBasedMultimap$WrappedCollection which is throwing NPE at deserializer in Tez Task. Explicit cast ensure kryo knows its ArrayList and won't use AbstractMapBasedMultimap$WrappedCollection avoiding this NPE.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @thomasrebele I suspect its more of Kryo-Guava deseralizer issue when children object is not null. Do you think we need to convert null to empty ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is safer to avoid
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another approach would be to check if
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, though I'll leave the null-check for another PR.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @thomasrebele, why not use jdk21 List.of() instead?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've seen that some callers of getChildren modify the list, e.g., DynamicPartitionPruningOptimization, so I've I opted for
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've created HIVE-29505 to make the children immutable. So I propose to postpone using |
||
| this.funcText = funcText; | ||
| } | ||
|
|
||
| /** | ||
| * Constructor. | ||
| * | ||
| * @param children the children; a copy is made, so later changes to the passed list | ||
| * do not affect the children of this instance | ||
| */ | ||
| // Backward-compatibility interfaces for functions without a user-visible name. | ||
| public ExprNodeGenericFuncDesc(TypeInfo typeInfo, GenericUDF genericUDF, | ||
| List<ExprNodeDesc> children) { | ||
| this(typeInfo, genericUDF, null, children); | ||
| } | ||
|
|
||
| /** | ||
| * Constructor. | ||
| * | ||
| * @param children the children; a copy is made, so later changes to the passed list | ||
| * do not affect the children of this instance | ||
| */ | ||
| public ExprNodeGenericFuncDesc(ObjectInspector oi, GenericUDF genericUDF, | ||
| List<ExprNodeDesc> children) { | ||
| this(oi, genericUDF, null, children); | ||
|
|
@@ -125,8 +149,14 @@ public void setGenericUDF(GenericUDF genericUDF) { | |
| this.genericUDF = genericUDF; | ||
| } | ||
|
|
||
| /** | ||
| * Sets the children. | ||
| * | ||
| * @param children the new children; a copy is made, so later changes to the passed list | ||
| * do not affect the children of this instance | ||
| */ | ||
| public void setChildren(List<ExprNodeDesc> children) { | ||
| this.children = children; | ||
| this.children = children == null ? new ArrayList<>() : new ArrayList<>(children); | ||
| } | ||
|
|
||
| @Override | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The doc seems a bit repetitive. We could possibly just put the mention about copy once over the field declaration:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to to see such information in the IDE when hovering over the constructor.