-
Notifications
You must be signed in to change notification settings - Fork 0
More Arc to AggregateFunctionExpr
#1
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
More Arc to AggregateFunctionExpr
#1
Conversation
This patch adds a benchmark aimed at tracking inefficiencies at the stage of creating/optimizing a physical plan.
Patch f5c47fa removed Arc wrappers for AggregateFunctionExpr. But, it can be inefficient. When physical optimizer decides to replace a node child to other, it clones the node (with `with_new_children`). Assume, that node is `AggregateExec` than contains hundreds aggregates and these aggregates are cloned each time. This patch returns a Arc wrapping to not clone AggregateFunctionExpr itself but clone a pointer.
This patch adds a small optimization that can soft the edges on some queries. If there are no parent requirements we do not need to build column mapping.
|
||
AggregateExprBuilder::new(Arc::new(updated_fn), self.args.to_vec()) | ||
.order_by(self.ordering_req.to_vec()) | ||
.schema(Arc::new(self.schema.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.
In particular, I believe this is a deep clone
) -> Result<Option<AggregateFunctionExpr>> { | ||
let Some(updated_fn) = self | ||
.fun | ||
.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.
this was also a deep clone
9d2d031
to
fdb0b33
Compare
Will create a PR to DataFusion main instead |
Ok, thank you, I was busy yesterday, I didn't have time to merge it :(. |
Targets apache#12950
This is a proposal to add even more
Arc
to theAggregateFunctionExpr
in order to reduce more deep clones