Skip to content

Conversation

Indhumathi27
Copy link
Contributor

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 (or colExprMap is null issue) that occurs when the parent operator is a UnionOperator during column statistics or partition column inference.

The root cause is that UnionOperator does not initialize colExprMap, 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

@Indhumathi27
Copy link
Contributor Author

@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;
Copy link
Contributor

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

Copy link
Contributor

@ngsg ngsg left a 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.

@Indhumathi27
Copy link
Contributor Author

@okumin @ngsg comments are addressed. Please help to merge. Thanks

Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants