Improve HashJoinExecBuilder to save state from previous fields#20276
Improve HashJoinExecBuilder to save state from previous fields#20276alamb merged 4 commits intoapache:mainfrom
HashJoinExecBuilder to save state from previous fields#20276Conversation
fbc498f to
dcc9cfa
Compare
jonathanc-n
left a comment
There was a problem hiding this comment.
I left a comment, but this is a nicely designed. Thanks!
HashJoinExecBuilder to save state from previous fields
alamb
left a comment
There was a problem hiding this comment.
Looks great to me -- thank you @askalt and @jonathanc-n
@2010YOUY01 what do you think about this?
| /// Builder can be created from an existing [`HashJoinExec`] using [`From::from`]. | ||
| /// In this case, all its fields are inherited. If a field that affects the node's | ||
| /// properties is modified, they will be automatically recomputed during the build. | ||
| pub struct HashJoinExecBuilder { |
There was a problem hiding this comment.
A minor API suggestion to make this code more discoverable might be to add an explicit method to HashJoinExec such as into_builder (and leave the From impl as well )
Something like
let builder = hash_join_exec.into_builder()There was a problem hiding this comment.
It seems typicaly into_* takes self, but here HashJoinExec is not clone (as I see from the comment it is done intentionally) so it is always never could be consumed. Added builder instead:
+ /// Create a builder based on the existing [`HashJoinExec`].
+ ///
+ /// Returned builder preserves all existing fields. If a field requiring properties
+ /// recomputation is modified, this will be done automatically during the node build.
+ ///
+ pub fn builder(&self) -> HashJoinExecBuilder {
+ self.into()
+ }
+dcc9cfa to
4347a27
Compare
|
Working on CI fix. |
Prior the patch HashJoinExecBuilder constructed from an existing node reseted some fields of the node, e.g. dynamic filters, metrics. It significantly reduces usage scope of the builder. This patch improves the implementation. Now builder created from the existing node preserves all fields in case they have not been explicitly updated. Also builder now tracks flag if it must recompute plan properties. Closes apache#20270
4347a27 to
0f33f41
Compare
|
I merged up to resolve a conflict |
|
And again |
|
🚀 thank you for the help @askalt @jonathanc-n |
Which issue does this PR close?
Closes #20270
Prior the patch HashJoinExecBuilder constructed from an existing node reseted some fields of the node, e.g. dynamic filters, metrics. It significantly reduces usage scope of the builder.
What changes are included in this PR?
This patch improves the implementation. Now builder created from the existing node preserves all fields in case they have not been explicitly updated. Also builder now tracks flag if it must recompute plan properties.