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.79% +0.12%
==========================================
Files 1147 1147
Lines 446542 450917 +4375
Branches 446542 450917 +4375
==========================================
+ Hits 369154 373318 +4164
+ Misses 54986 54880 -106
- Partials 22402 22719 +317 ☔ 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 🙏
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.