Repository navigation
Conversation
eb9fcb7 to
c3496a3
Compare
99ca719 to
560040a
Compare
6c850b7 to
52043c8
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #25710 +/- ##
==========================================
+ Coverage 82.66% 82.84% +0.17%
==========================================
Files 1147 1149 +2
Lines 446542 452813 +6271
Branches 446542 452813 +6271
==========================================
+ Hits 369154 375150 +5996
+ Misses 54986 54840 -146
- Partials 22402 22823 +421 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@alamb tagging you because you might be interested in the optimization this enables, given that github considers you a contributor to Datafusion Query Cache |
alamb
left a comment
There was a problem hiding this comment.
Thank you @masonh22 and @thinkharderdev and @Dandandan
This looks like a nice improvement code and testing wise to me, though I am a little worried about the somewhat non standard testing feature (mostly that it add some tiny more amount of complexity to a system that is already pretty complicated).
I left some comments, but I also think this PR could be merged as is
Thank you for the cleanup 🙏
c65aae3 to
acb05c9
Compare
|
@alamb it looks like CI failed in the hash collisions mode for the test I added because I went ahead and updated Alternatively, I could disable the test I added when the hash collision feature is enabled. Let me know what you would prefer. |
Sounds good to me -- thanks |
Which issue does this PR close?
AggregateUDFImpl'sAccumulatorandGroupsAccumulator#25660.Rationale for this change
See #25660.
This change only documents/enforces this requirement for built-in aggregate UDF functions. Anyone who implements their own aggregate UDFs do not need to adhere to this requirement since vanilla datafusion doesn't require it. This does add a public test that user's can use to make sure this requirement is satisfied if they desire.
What changes are included in this PR?
This change adds:
datafusion_functions_aggregate::testing::check_state_compatibility(): A generic test that identifies cases where theAccumulatorandGroupsAccumulatorof anAggregateUDFdiffer. This is exposed as a public function that can be used to test this requirement onAggregateUDFImpls implemented by downstream consumers. The test is run on all built-in default aggregation functions.approx_distinct()andavg(), which both violated this requirementHLLAccumulatorused byapprox_distinct()to consume state produced byHllGroupsAccumulator#25659 to fixapprox_distinct()Accumulatorforavg()would return0for the count if it hasn't seen any non-null values. TheGroupsAccumulatorwould returnnullinstead. This change updates theAccumulators to also returnnullfor the count in this case.What is the testing strategy for this PR?
This adds a test to enforce this new requirement in a generic way.
Are there any user-facing changes?
This changes the intermediate state of the
avg()accumulator to match theavg()groups accumulator, which some users may be affected by.