fix: revert unsafe partial aggregates after final fallback - #5421
Open
sunchao wants to merge 1 commit into
Open
Conversation
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.
Why are the changes needed?
Closes #5419.
The existing unsafe-partial prepass checks aggregate expressions before child conversion is known. A final aggregate can pass that check and then fall back because its shuffle child is not native, leaving a native partial whose buffers are not declared safe for Spark consumption.
This is observable with decimal AVG: filtering four scan partitions down to one matching row returns
NULLinstead of200.000000, with AQE either off or on. The unsafe partial must be reverted before AQE materializes its output.What changes were proposed in this PR?
The independent empty-AVG-state issue is tracked in #5418. This PR is tested with the unmodified native library and does not depend on that fix.
How was this PR tested?
main, all four new targeted regressions failed; after this change, all four passed, with no aborted suites.CometAggregateSuite,CometExecRuleSuite, andCometShuffleFallbackStickinessSuite: 121 passed, zero failures/aborted suites, and two existing Spark-version-gated cancellations (123 registered tests).git diff --checkpassed.