-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -225,10 +225,10 @@ impl AggregateUDF { | |
|
|
||
| /// See [`AggregateUDFImpl::with_beneficial_ordering`] for more details. | ||
| pub fn with_beneficial_ordering( | ||
| self, | ||
| self: Arc<Self>, | ||
| beneficial_ordering: bool, | ||
| ) -> Result<Option<AggregateUDF>> { | ||
| self.inner | ||
| Arc::clone(&self.inner) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code doesn't explain why |
||
| .with_beneficial_ordering(beneficial_ordering) | ||
| .map(|updated_udf| updated_udf.map(|udf| Self { inner: udf })) | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -133,11 +133,11 @@ impl AggregateExprBuilder { | |||||
| }; | ||||||
|
|
||||||
| Ok(AggregateFunctionExpr { | ||||||
| fun: Arc::unwrap_or_clone(fun), | ||||||
| fun, | ||||||
| args, | ||||||
| data_type, | ||||||
| name, | ||||||
| schema: Arc::unwrap_or_clone(schema), | ||||||
| schema, | ||||||
| ordering_req, | ||||||
| ignore_nulls, | ||||||
| ordering_fields, | ||||||
|
|
@@ -197,12 +197,12 @@ impl AggregateExprBuilder { | |||||
| /// Physical aggregate expression of a UDAF. | ||||||
| #[derive(Debug, Clone)] | ||||||
| pub struct AggregateFunctionExpr { | ||||||
| fun: AggregateUDF, | ||||||
| fun: Arc<AggregateUDF>, | ||||||
| args: Vec<Arc<dyn PhysicalExpr>>, | ||||||
| /// Output / return type of this aggregate | ||||||
| data_type: DataType, | ||||||
| name: String, | ||||||
| schema: Schema, | ||||||
| schema: Arc<Schema>, | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 |
||||||
| // The physical order by expressions | ||||||
| ordering_req: LexOrdering, | ||||||
| // Whether to ignore null values | ||||||
|
|
@@ -331,17 +331,15 @@ impl AggregateFunctionExpr { | |||||
| self: Arc<Self>, | ||||||
| beneficial_ordering: bool, | ||||||
| ) -> Result<Option<AggregateFunctionExpr>> { | ||||||
| let Some(updated_fn) = self | ||||||
| .fun | ||||||
| .clone() | ||||||
| .with_beneficial_ordering(beneficial_ordering)? | ||||||
| let Some(updated_fn) = | ||||||
| Arc::clone(&self.fun).with_beneficial_ordering(beneficial_ordering)? | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| else { | ||||||
| return Ok(None); | ||||||
| }; | ||||||
|
|
||||||
| AggregateExprBuilder::new(Arc::new(updated_fn), self.args.to_vec()) | ||||||
| .order_by(self.ordering_req.to_vec()) | ||||||
| .schema(Arc::new(self.schema.clone())) | ||||||
| .schema(Arc::clone(&self.schema)) | ||||||
| .alias(self.name().to_string()) | ||||||
| .with_ignore_nulls(self.ignore_nulls) | ||||||
| .with_distinct(self.is_distinct) | ||||||
|
|
@@ -474,7 +472,7 @@ impl AggregateFunctionExpr { | |||||
|
|
||||||
| 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)) | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❤️ |
||||||
| .alias(name) | ||||||
| .with_ignore_nulls(self.ignore_nulls) | ||||||
| .with_distinct(self.is_distinct) | ||||||
|
|
||||||
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?