-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Refactor DataSourceExec::try_swapping_with_projection to simplify and remove abstraction leakage #17395
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
Conversation
… remove abstraction leakage
| // Project the equivalence properties to the new schema | ||
| let projected_eq_properties = self | ||
| .cache | ||
| .eq_properties | ||
| .project(&projection_mapping, new_data_source_exec.schema()); | ||
|
|
||
| let preserved_exec = DataSourceExec { | ||
| data_source: Arc::clone(&new_data_source_exec.data_source), | ||
| cache: PlanProperties::new( | ||
| projected_eq_properties, | ||
| new_data_source_exec.cache.partitioning.clone(), | ||
| new_data_source_exec.cache.emission_type, | ||
| new_data_source_exec.cache.boundedness, | ||
| ) | ||
| .with_scheduling_type(new_data_source_exec.cache.scheduling_type), | ||
| }; |
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.
We get to remove all of this complexity now 😄
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.
datafusion/datasource/src/memory.rs
Outdated
| .transpose() | ||
| .transpose()?; | ||
|
|
||
| Ok(res) |
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.
nit: return directly
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.
blaginin
left a comment
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.
much cleaner, thank you for that!
|
Thanks for the review @blaginin ! I also added a note to the upgrade guide. |
| } | ||
| } | ||
|
|
||
| pub type ProjectionExpr = (Arc<dyn PhysicalExpr>, String); |
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.
I recommend a future PR transform this into a struct with named fields. That will be a breaking change so I am not going to do it in this PR, it should be done in isolation.
… remove abstraction leakage (apache#17395)
This PR simplifies
try_swapping_with_projectionby: