You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "Ted-Jiang (via GitHub)" <gi...@apache.org> on 2024/04/12 08:21:29 UTC
[PR] Improve ApproxPercentileAccumulator merge api and fix bug [arrow-datafusion]
Ted-Jiang opened a new pull request, #10056:
URL: https://github.com/apache/arrow-datafusion/pull/10056
## Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
-->
Closes #10055.
## Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.
-->
## What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
-->
## Are these changes tested?
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
-->
## Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be updated before approving the PR.
-->
<!--
If there are any breaking changes to public APIs, please add the `api change` label.
-->
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve ApproxPercentileAccumulator merge api and fix bug [arrow-datafusion]
Posted by "Ted-Jiang (via GitHub)" <gi...@apache.org>.
Ted-Jiang commented on code in PR #10056:
URL: https://github.com/apache/arrow-datafusion/pull/10056#discussion_r1562205175
##########
datafusion/physical-expr/src/aggregate/approx_percentile_cont.rs:
##########
@@ -284,7 +284,9 @@ impl ApproxPercentileAccumulator {
}
pub(crate) fn merge_digests(&mut self, digests: &[TDigest]) {
- self.digest = TDigest::merge_digests(digests);
+ let mut input_digests = digests.to_vec();
Review Comment:
As one Accumulator call merge() should not lose it inner status, this is not a good API desgion.
##########
datafusion/physical-expr/src/aggregate/approx_percentile_cont.rs:
##########
@@ -284,7 +284,9 @@ impl ApproxPercentileAccumulator {
}
pub(crate) fn merge_digests(&mut self, digests: &[TDigest]) {
- self.digest = TDigest::merge_digests(digests);
+ let mut input_digests = digests.to_vec();
Review Comment:
As one Accumulator call merge() should not lose it inner status, this is not a good API desgin.
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve ApproxPercentileAccumulator merge api and fix bug [arrow-datafusion]
Posted by "Ted-Jiang (via GitHub)" <gi...@apache.org>.
Ted-Jiang merged PR #10056:
URL: https://github.com/apache/arrow-datafusion/pull/10056
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve ApproxPercentileAccumulator merge api and fix bug [arrow-datafusion]
Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on code in PR #10056:
URL: https://github.com/apache/arrow-datafusion/pull/10056#discussion_r1562932618
##########
datafusion/physical-expr/src/aggregate/approx_percentile_cont.rs:
##########
@@ -284,7 +284,9 @@ impl ApproxPercentileAccumulator {
}
pub(crate) fn merge_digests(&mut self, digests: &[TDigest]) {
- self.digest = TDigest::merge_digests(digests);
+ let mut input_digests = digests.to_vec();
Review Comment:
The change makes sense to me, but it is hard to review without a test that demonstrates the incorrect behavior. Would it be possible to add a unit test as part of this PR?
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve ApproxPercentileAccumulator merge api and fix bug [arrow-datafusion]
Posted by "Ted-Jiang (via GitHub)" <gi...@apache.org>.
Ted-Jiang commented on PR #10056:
URL: https://github.com/apache/arrow-datafusion/pull/10056#issuecomment-2051398335
@alamb @jychen7 PTAL
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve ApproxPercentileAccumulator merge api and fix bug [arrow-datafusion]
Posted by "Ted-Jiang (via GitHub)" <gi...@apache.org>.
Ted-Jiang commented on PR #10056:
URL: https://github.com/apache/arrow-datafusion/pull/10056#issuecomment-2054725111
add a test on digest merge [add test for accumulator merge_digests](https://github.com/apache/arrow-datafusion/pull/10056/commits/ac7dbd60997e52bc47e519886827cbdbaaf54c13)
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve ApproxPercentileAccumulator merge api and fix bug [arrow-datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #10056:
URL: https://github.com/apache/arrow-datafusion/pull/10056#issuecomment-2053649049
Marking as draft as I think this PR is waiting on a test
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve ApproxPercentileAccumulator merge api and fix bug [arrow-datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #10056:
URL: https://github.com/apache/arrow-datafusion/pull/10056#discussion_r1562982102
##########
datafusion/physical-expr/src/aggregate/approx_percentile_cont.rs:
##########
@@ -284,7 +284,9 @@ impl ApproxPercentileAccumulator {
}
pub(crate) fn merge_digests(&mut self, digests: &[TDigest]) {
- self.digest = TDigest::merge_digests(digests);
+ let mut input_digests = digests.to_vec();
Review Comment:
100% agree we should add a test for this fix (otherwise we may break the behavior again in a subsequent refactoring, for example)
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Improve ApproxPercentileAccumulator merge api and fix bug [arrow-datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #10056:
URL: https://github.com/apache/arrow-datafusion/pull/10056#discussion_r1565585057
##########
datafusion/physical-expr/src/aggregate/approx_percentile_cont.rs:
##########
@@ -284,7 +284,9 @@ impl ApproxPercentileAccumulator {
}
pub(crate) fn merge_digests(&mut self, digests: &[TDigest]) {
- self.digest = TDigest::merge_digests(digests);
+ let mut input_digests = digests.to_vec();
+ input_digests.push(self.digest.clone());
Review Comment:
I think it is possible to avoid these clones -- here is a proposal that targets this PR https://github.com/Ted-Jiang/arrow-datafusion/pull/118 to do so
--
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@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org