-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Avoid copies in InlineTableScan
via TreeNode API
#10038
Conversation
Filter::try_new(new_expr, filter.input) | ||
.map(|e| Transformed::yes(LogicalPlan::Filter(e))) | ||
// rewrite any subqueries in the plan first | ||
let result = plan.map_subqueries(|plan| plan.transform_up(&analyze_internal))?; |
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 is the new API that @peter-toth added in #9913
|
||
fn rewrite_subquery(expr: Expr) -> Result<Transformed<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.
this is now handled by apply_subqueries
fn rewrite_subquery(expr: Expr) -> Result<Transformed<Expr>> { | ||
match expr { | ||
Expr::Exists(Exists { subquery, negated }) => { | ||
let plan = subquery.subquery.as_ref().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.
these clones are avoided in the current formulation
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.
Small readability nitpick.
Filter::try_new(new_expr, filter.input) | ||
.map(|e| Transformed::yes(LogicalPlan::Filter(e))) | ||
// rewrite any subqueries in the plan first | ||
let result = plan.map_subqueries(|plan| plan.transform_up(&analyze_internal))?; |
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.
let result = plan.map_subqueries(|plan| plan.transform_up(&analyze_internal))?; | |
let plan = plan.map_subqueries(|plan| plan.transform_up(&analyze_internal))?; |
When I read "result" I'm kinda expecting this to be a Result<_, _>
which -- based on the result.transform_data
call below -- is not the case here.
Same comment applies to the let result
a few lines below.
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 is a good call -- renamed to transformed_plan
in 0e0ac8e
Thanks again @crepererum |
Which issue does this PR close?
Part of #9637 -- let's make DataFusion planning faster by not copying so much
Rationale for this change
Now that we have the nice TreeNode API thanks to #8913 and @peter-toth let's use it to both simplify the code and avoid copies
What changes are included in this PR?
Rewrite
InlineTableScan
using TreeNode APIAre these changes tested?
Existing CI
Are there any user-facing changes?