-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Support filter in cross join elimination #13025
Conversation
@@ -253,13 +269,7 @@ fn flatten_join_inputs( | |||
fn can_flatten_join_inputs(plan: &LogicalPlan) -> bool { | |||
// can only flatten inner / cross joins |
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.
perhaps we can add the reason why only inner/cross joins can be flattened?
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 think the reason is that the current code doesn't support that / it's not obvious how it could work for non-inner joins.
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.
This PR makes sense to me -- thank you @Dandandan and @comphead
@@ -660,7 +663,17 @@ mod tests { | |||
.filter(col("t1.a").gt(lit(15u32)))? | |||
.build()?; | |||
|
|||
assert_optimization_rule_fails(plan); | |||
let expected = vec![ |
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.
this plan seems correct to me
@@ -1152,7 +1152,7 @@ logical_plan | |||
01)Projection: t1.v0, t1.v1, t5.v2, t5.v3, t5.v4, t0.v0, t0.v1 | |||
02)--Inner Join: CAST(t1.v0 AS Float64) = t0.v1 Filter: t0.v1 + CAST(t5.v0 AS Float64) > Float64(0) | |||
03)----Projection: t1.v0, t1.v1, t5.v0, t5.v2, t5.v3, t5.v4 | |||
04)------Inner Join: Using t1.v0 = t5.v0, t1.v1 = t5.v1 | |||
04)------Inner Join: t1.v0 = t5.v0, t1.v1 = t5.v1 |
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.
This basically seems like it is the same plan to me (just with a different syntax 🤔 )
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.
Yeah it's just the rule now "rewrites" it, before it didn't because of the filter in the join above it.
Which issue does this PR close?
Closes #7549, #4877
Rationale for this change
Simplifying optimization rule and supporting an extra case, adding more opportunity for optimization.
What changes are included in this PR?
Are these changes tested?
Are there any user-facing changes?