-
Notifications
You must be signed in to change notification settings - Fork 4.8k
HIVE-29267: Fix NPE on Grouping Sets Optimizer for UNION ALL Queries #6128
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?
Conversation
@okumin can you help to review this PR. Thanks |
select grpBy_col, sum(col2) | ||
from | ||
( select 'abc' as grpBy_col, col2 from sub_qr union all select 'def' as grpBy_col, col2 from sub_qr) x | ||
group by grpBy_col with rollup; |
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 confirmed the master branch definitely throws a NPE
ql/src/java/org/apache/hadoop/hive/ql/optimizer/GroupingSetOptimizer.java
Outdated
Show resolved
Hide resolved
5050529
to
f8bcb20
Compare
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.
LGTM, +1. I just left one minor nit.
ql/src/java/org/apache/hadoop/hive/ql/optimizer/GroupingSetOptimizer.java
Outdated
Show resolved
Hide resolved
f8bcb20
to
7bf00f1
Compare
7bf00f1
to
60596a6
Compare
|
What changes were proposed in this pull request?
This change adds a defensive null check before accessing
getColumnExprMap()
Why are the changes needed?
This PR fixes a
NullPointerException
(orcolExprMap is null
issue) that occurs when the parent operator is aUnionOperator
during column statistics or partition column inference.The root cause is that
UnionOperator
does not initializecolExprMap
, since it merely merges rows from multiple inputs and does not perform column expression transformations.Existing code paths assumed that every parent operator had a non-null
colExprMap
, which led to NPEs when traversing the operator tree.Does this PR introduce any user-facing change?
No
How was this patch tested?
Test scenario added