-
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
Remove expr_sub_expressions and rewrite_expression functions #2772
Conversation
d0738ce
to
a3137a6
Compare
Codecov Report
@@ Coverage Diff @@
## master #2772 +/- ##
==========================================
+ Coverage 84.95% 85.15% +0.20%
==========================================
Files 271 272 +1
Lines 48164 48073 -91
==========================================
+ Hits 40916 40938 +22
+ Misses 7248 7135 -113
Continue to review full report at Codecov.
|
a3137a6
to
72f92f2
Compare
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.
Co-authored-by: Andy Grove <andygrove73@gmail.com>
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 looks great -- what a nice cleanup. Thank you @mrob95 !
Something I'm unsure of: I feel like I'm using Expr.clone all over the place - for example in filter_push_down at the call sites of replace_cols_by_name - but I don't have enough rust experience to know if this is a problem or not..
I think this is a consequence of the fact that the optimizer passes create new LogicalPlan
s (rather than rewriting the existing ones). Maybe we can work to improve this over time but it is tricky as the logical plans are sometimes wrapped in Arc
s (and can be shared).
I don't think this PR adds any new copies, but it makes the cloning more obvious (previously expr_sub_expression
and rewrite_expression
internally made all the clones.
logical_plan::{Filter, LogicalPlan}, | ||
utils::from_plan, | ||
Expr, Operator, | ||
}; | ||
use std::sync::Arc; | ||
|
||
const CASE_EXPR_MARKER: &str = "__DATAFUSION_CASE_EXPR__"; |
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.
🔥 very nice
Which issue does this PR close?
Follows from #2736 and #2765
Rationale for this change
These functions were redundant with
ExprVisitor
andExprRewriter
and were error prone (as demonstrated in #2736).What changes are included in this PR?
Replaced all users of these functions with a visitor or a rewriter as necessary, and deleted them.
Something I'm unsure of: I feel like I'm using
Expr.clone
all over the place - for example infilter_push_down
at the call sites ofreplace_cols_by_name
- but I don't have enough rust experience to know if this is a problem or not..Are there any user-facing changes?