Avoid changing project_schema signature#2
Closed
alamb wants to merge 2 commits intoaskalt:askalt/with_new_children_fast_pathfrom
Closed
Avoid changing project_schema signature#2alamb wants to merge 2 commits intoaskalt:askalt/with_new_children_fast_pathfrom
alamb wants to merge 2 commits intoaskalt:askalt/with_new_children_fast_pathfrom
Conversation
This patch aims to implement a fast-path for the ExecutionPlan::with_new_children function for some plans, moving closer to a physical plan re-use implementation and improving planning performance. If the passed children properties are the same as in self, we do not actually recompute self's properties (which could be costly if projection mapping is required). Instead, we just replace the children and re-use self's properties as-is. To be able to compare two different properties -- ExecutionPlan::properties(...) signature is modified and now returns `&Arc<PlanProperties>`. If `children` properties are the same in `with_new_children` -- we clone our properties arc and then a parent plan will consider our properties as unchanged, doing the same. Also, there are other improvements. The patch includes the following changes: - Return `&Arc<PlanProperties>` from `ExecutionPlan::properties(...)` instead of a reference. - Implement `with_new_children` fast-path if there is no children properties changes for all major plans. - Store `Arc<[usize]>` instead of vector within `FilterExec`. - Store `Arc<[usize]>` instead of vector within projection of `HashJoinExec`. - Store `Arc<[Arc<AggregateFunctionExpr>]>` instead of vec for aggr expr and filters. - Store `Arc<[ProjectionExpr]> instead of vec in `ProjectionExprs` struct. - Get `Option<&[usize]>` instead of option vec ref in `project_schema` -- it makes API more flexible. Note: currently, `reset_plan_states` does not allow to re-use plan in general: it is not supported for dynamic filters and recursive queries features, as in this case state reset should update pointers in the children plans. Closes apache#19796
alamb
commented
Jan 15, 2026
| /// projecting to `vec![2, 1]` would return statistics for columns `{"c", | ||
| /// "b"}`. | ||
| pub fn project(mut self, projection: Option<&[usize]>) -> Self { | ||
| pub fn project(mut self, projection: Option<impl AsRef<[usize]>>) -> Self { |
Author
There was a problem hiding this comment.
The idea is to make this function generic so the previous signature can mostly be used
509e3ff to
528149c
Compare
Owner
|
@alamb Thank you! Applied a similar suggestion, please check apache#19893 |
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.
This is a proposal for apache#19792 that avoids having to change most callsites of
project_schema