Conversation
Override `AggregateUDFImpl::distinct_handling` on the Spark aggregates to match what their accumulators actually do: - `collect_set`: `Insensitive`, the accumulator always deduplicates, so `EliminateAggregateDistinct` can drop a redundant `DISTINCT`. - `collect_list`, `try_sum`: `Unsupported`, the accumulators ignore `is_distinct` and silently return the non-distinct result. - `avg`: `Unsupported`, the accumulator rejects `DISTINCT` with an error. Adds unit tests asserting each function's tag and a sqllogictest showing `collect_set(DISTINCT x)` is planned as `collect_set(x)`. Closes apache#25375 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #25384 +/- ##
=======================================
Coverage 81.93% 81.93%
=======================================
Files 1136 1136
Lines 429152 429180 +28
Branches 429152 429180 +28
=======================================
+ Hits 351633 351669 +36
+ Misses 56475 56466 -9
- Partials 21044 21045 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Rationale for this change
#25288 adds distinct handling to udfs, which let an aggregate declare whether DISTINCT can change its result. This pr adds distinct handling on the Spark aggregates to match what their accumulators actually do:
collect_set:Insensitive, the accumulator always deduplicates.collect_list,try_sum:Unsupported, the accumulators ignoreis_distinctand silently return the non-distinct result.avg:Unsupported, the accumulator rejectsDISTINCTwith an error.What changes are included in this PR?
see above.
What is the testing strategy for this PR?
Are there any user-facing changes?
No
LLM-generated code disclosure
This PR includes LLM-generated code and comments. All LLM-generated content has been manually reviewed.