-
Notifications
You must be signed in to change notification settings - Fork 599
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
fix(optimizer): can't apply pull_up_correlated_predicate_agg_rule with non-null-propagating expr #20012
Conversation
…h non-null-propagating expr Signed-off-by: xxchan <[email protected]>
src/frontend/src/optimizer/rule/pull_up_correlated_predicate_agg_rule.rs
Outdated
Show resolved
Hide resolved
Signed-off-by: xxchan <[email protected]>
src/frontend/src/optimizer/rule/pull_up_correlated_predicate_agg_rule.rs
Show resolved
Hide resolved
Signed-off-by: xxchan <[email protected]>
.predicate() | ||
.conjunctions | ||
.iter() | ||
.any(|expr| !Strong::is_null(expr, top_proj_null_bitset.clone())) | ||
{ | ||
.all(|expr| Strong::is_null(expr, top_proj_null_bitset.clone())); |
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.
It should be any.
.all(|expr| Strong::is_null(expr, top_proj_null_bitset.clone())); | |
.any(|expr| Strong::is_null(expr, top_proj_null_bitset.clone())); |
let mut top_proj_null_bitset = | ||
FixedBitSet::with_capacity(top_project.base.schema().len() + apply_left_schema); | ||
for (i, expr) in top_proj_exprs.iter().enumerate() { | ||
if Strong::is_null(expr, agg_null_bitset.clone()) { | ||
top_proj_null_bitset.insert(i + apply_left_schema); | ||
} else { | ||
top_proj_all_null = false; |
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.
When Strong::is_null
return false, it means we can't get any useful information, so we shouldn't allow apply rule based on it.
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.
Rest LGTM! Thanks
Signed-off-by: xxchan <[email protected]>
Signed-off-by: xxchan <[email protected]>
Signed-off-by: xxchan <[email protected]>
@xxchan I don't see this commit in the latest tags |
…h non-null-propagating expr (#20012) Signed-off-by: xxchan <[email protected]>
I think it can be cherry-picked into 2.2 which hasn't been released yet |
I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
fix #19835
Previously we check whether the Agg is
count
to decide whether the rule can be applied, but there are some other cases not considered, e.g.,coalesce
. We should check whether the agg/expr is "null-propagating".The rule:
After:
Checklist
Documentation
Release note