You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2026/08/12 21:06:51 UTC
[PR] Minor: avoid a few clones in sum accumulator setup [datafusion]
alamb opened a new pull request, #24309:
URL: https://github.com/apache/datafusion/pull/24309
## Which issue does this PR close?
- follow on to https://github.com/apache/datafusion/pull/24035
## Rationale for this change
This is a minor thing I found while doing some performance profiling for https://github.com/apache/datafusion/pull/24035
## What changes are included in this PR?
Avoid a few clone calls
## Are these changes tested?
By CI
## Are there any user-facing changes?
realistically nothing that someone will measure
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Minor: avoid a few clones in sum accumulator setup [datafusion]
Posted by "jayzhan211 (via GitHub)" <gi...@apache.org>.
jayzhan211 commented on PR #24309:
URL: https://github.com/apache/datafusion/pull/24309#issuecomment-5280440103
LGTM 👍🏻
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Minor: avoid a few clones in sum accumulator setup [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #24309:
URL: https://github.com/apache/datafusion/pull/24309#discussion_r3770340622
##########
datafusion/functions-aggregate-common/src/aggregate/sum_distinct/numeric.rs:
##########
@@ -40,10 +40,10 @@ pub struct DistinctSumAccumulator<T: ArrowPrimitiveType> {
}
impl<T: ArrowPrimitiveType> DistinctSumAccumulator<T> {
- pub fn new(data_type: &DataType) -> Self {
+ pub fn new(data_type: DataType) -> Self {
Self {
values: GenericDistinctBuffer::new(data_type.clone()),
- data_type: data_type.clone(),
+ data_type,
Review Comment:
this is one clone removed
##########
datafusion/functions-aggregate/src/sum.rs:
##########
@@ -264,14 +264,14 @@ impl AggregateUDFImpl for Sum {
if args.is_distinct {
macro_rules! helper {
($t:ty, $dt:expr) => {
- Ok(Box::new(DistinctSumAccumulator::<$t>::new(&$dt)))
+ Ok(Box::new(DistinctSumAccumulator::<$t>::new($dt)))
};
}
downcast_sum!(args, helper)
} else {
macro_rules! helper {
($t:ty, $dt:expr) => {
- Ok(Box::new(SumAccumulator::<$t>::new($dt.clone())))
Review Comment:
this is the second clone removed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Minor: avoid a few clones in sum accumulator setup [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #24309:
URL: https://github.com/apache/datafusion/pull/24309#issuecomment-5284456506
Thanks @gabotechs and @jayzhan211
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Minor: avoid a few clones in sum accumulator setup [datafusion]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #24309:
URL: https://github.com/apache/datafusion/pull/24309#issuecomment-5273061440
## [Codecov](https://app.codecov.io/gh/apache/datafusion/pull/24309?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 81.14%. Comparing base ([`bbb552f`](https://app.codecov.io/gh/apache/datafusion/commit/bbb552f71c93cdfadf91b374a3c4ff5f1a931ae7?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`c2d13e7`](https://app.codecov.io/gh/apache/datafusion/commit/c2d13e7e917780ddd68e3f4c61511707bf76a94f?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## main #24309 +/- ##
==========================================
- Coverage 81.14% 81.14% -0.01%
==========================================
Files 1110 1110
Lines 386137 386137
Branches 386137 386137
==========================================
- Hits 313347 313339 -8
- Misses 54324 54330 +6
- Partials 18466 18468 +2
```
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/datafusion/pull/24309?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] Minor: avoid a few clones in sum accumulator setup [datafusion]
Posted by "jayzhan211 (via GitHub)" <gi...@apache.org>.
jayzhan211 merged PR #24309:
URL: https://github.com/apache/datafusion/pull/24309
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org