-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add More Arc to AggregateFunctionExpr
#13012
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
|
Running performance tests... |
| /// See [`AggregateUDFImpl::with_beneficial_ordering`] for more details. | ||
| pub fn with_beneficial_ordering( | ||
| self, | ||
| self: Arc<Self>, |
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.
What's the benefit of using Arc here?
| self: Arc<Self>, | |
| &self |
| .clone() | ||
| .with_beneficial_ordering(beneficial_ordering)? | ||
| let Some(updated_fn) = | ||
| Arc::clone(&self.fun).with_beneficial_ordering(beneficial_ordering)? |
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.
| Arc::clone(&self.fun).with_beneficial_ordering(beneficial_ordering)? | |
| self.fun.with_beneficial_ordering(beneficial_ordering)? |
| AggregateExprBuilder::new(reverse_udf, self.args.to_vec()) | ||
| .order_by(reverse_ordering_req.to_vec()) | ||
| .schema(Arc::new(self.schema.clone())) | ||
| .schema(Arc::clone(&self.schema)) |
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.
❤️
| data_type: DataType, | ||
| name: String, | ||
| schema: Schema, | ||
| schema: Arc<Schema>, |
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.
👍
| beneficial_ordering: bool, | ||
| ) -> Result<Option<AggregateUDF>> { | ||
| self.inner | ||
| Arc::clone(&self.inner) |
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.
The code doesn't explain why AggregateUDFImpl::with_beneficial_ordering takes an Arc (it could as well take &self), but that's for later
|
I ran some benchmarks and didn't see any noticable difference in performance: So I am inclined to not pursue this PR |
|
tpch queries operate on rather small (narrow) schemas. |
That is true -- I do think I am sure this makes things a tiny bit faster but my benchmarks suggest it isn't very measurable |
|
Wouldn't it be better to maintain consistency throughout the entire codebase? |
I agree it would be good to maintain consistency when possible. Are you thinking that this PR is more consistent? It is not entirely clear to me how much we like / don't like Arc (I don't think it is totally consistent yet) |
I figured, but their names suggest these are very simple queries. and real-life will have combination of both: wide schemas and complex query plans, where optimizers will do more changes along the way. |
Draft as I run benchmarks
Which issue does this PR close?
Follow on to #12950
Rationale for this change
While reviewing #12950 from @askalt I noticed a few places where deep copies of Schema was happening when we could have simply been copying
ArcsWhat changes are included in this PR?
Add some more
Arcto improce performanceAre these changes tested?
Are there any user-facing changes?