-
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
Rewrite subexpressions of InSubquery in rewrite_expression #2765
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2765 +/- ##
=======================================
Coverage 84.95% 84.96%
=======================================
Files 271 271
Lines 48053 48071 +18
=======================================
+ Hits 40824 40842 +18
Misses 7229 7229
Continue to review full report at Codecov.
|
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. Thanks @mrob95!
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.
Love it -- this is a great first contribution @mrob95 ❤️
\n TableScan: test projection=None"; | ||
assert_eq!(format!("{:?}", plan), expected_before); | ||
|
||
// rewrite filter col b to test.a |
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.
👍
Thanks, going to see if I can do this ^ as well, but that can be a separate PR :) |
Which issue does this PR close?
Closes #2736.
Rationale for this change
What changes are included in this PR?
Looking at the expressions mentioned in #2725, I think the only one that needs fixing is
Expr::InSubquery
.Exists
andScalarSubquery
both have subqueries but not subexpressions, and it looks like subqueries are currently treated as completely separate plans for the purposes of optimisation. I'm new to working on query engines (and rust, for that matter!) though so may be misinterpreting this.I've modified
rewrite_expression
soInSubquery
exprs use the subexpression passed inexpressions
rather than just returning a clone, and added a pushdown test with anInSubquery
predicate which uses an aliased column.Additionally, I noticed while I was creating the test case that
InSubquery
filters were not being pushed down at all. This was because the subexpressions ofInSubquery
were not being visited byExpressionVisitor
, so the column inInSubquery
predicates was not found. Fixed with a simple modification toexpr_visitor.rs
. The test case I added covers this as well.Are there any user-facing changes?