-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[BugFix] Should use AggRewriteInfo.NOT_REWRITE other than throw exception when mv rewrite #49168
Conversation
if (realAggregate == null) { | ||
logMVRewrite(mvRewriteContext, "realAggregate is null"); | ||
return AggRewriteInfo.NOT_REWRITE; | ||
} | ||
realAggregate = replaceAggFuncArgument(remapping, origAggColRef, realAggregate, foundIndex); | ||
|
||
ColumnRefOperator newAggColRef = queryColumnRefFactory.create(realAggregate, |
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 most risky bug in this code is:
Potential null pointer exception if newAggregate
is referenced when foundIndex
is -1.
You can modify the code like this:
if (foundIndex == -1) {
logMVRewrite(mvRewriteContext, "no aggregate functions found: " + newAggregate != null ? newAggregate.getChildren() : "null");
return AggRewriteInfo.NOT_REWRITE;
}
3bd6a4a
to
0d730c8
Compare
…tion when mv rewrite Signed-off-by: kaijian.ding <[email protected]>
Quality Gate passedIssues Measures |
[FE Incremental Coverage Report]❌ fail : 6 / 15 (40.00%) file detail
|
[BE Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
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
@Mergifyio backport branch-3.3 |
✅ Backports have been created
|
…tion when mv rewrite (#49168) Signed-off-by: kaijian.ding <[email protected]> (cherry picked from commit ba8115b)
…tion when mv rewrite (backport #49168) (#49309) Co-authored-by: kaijianding <[email protected]>
Why I'm doing:
test_pt
in sql like below failed to transform to it's mvWhat I'm doing:
Fixes #issue
What type of PR is this:
Does this PR entail a change in behavior?
Bugfix cherry-pick branch check: