Avoid copies in InlineTableScan via TreeNode API#10038
Merged
alamb merged 3 commits intoapache:mainfrom Apr 12, 2024
Merged
Conversation
alamb
commented
Apr 10, 2024
| 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))?; |
Contributor
Author
There was a problem hiding this comment.
This is the new API that @peter-toth added in #9913
alamb
commented
Apr 10, 2024
| } | ||
| })?; | ||
|
|
||
| fn rewrite_subquery(expr: Expr) -> Result<Transformed<Expr>> { |
Contributor
Author
There was a problem hiding this comment.
this is now handled by apply_subqueries
alamb
commented
Apr 10, 2024
| fn rewrite_subquery(expr: Expr) -> Result<Transformed<Expr>> { | ||
| match expr { | ||
| Expr::Exists(Exists { subquery, negated }) => { | ||
| let plan = subquery.subquery.as_ref().clone(); |
Contributor
Author
There was a problem hiding this comment.
these clones are avoided in the current formulation
crepererum
approved these changes
Apr 11, 2024
Contributor
crepererum
left a comment
There was a problem hiding this comment.
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))?; |
Contributor
There was a problem hiding this comment.
Suggested change
| 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.
Contributor
Author
There was a problem hiding this comment.
It is a good call -- renamed to transformed_plan in 0e0ac8e
31 tasks
Contributor
Author
|
Thanks again @crepererum |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
InlineTableScanusing TreeNode APIAre these changes tested?
Existing CI
Are there any user-facing changes?