Repository navigation
fix: compact FIRST_VALUE scalars during merge - #26743
Open
shehabgamin wants to merge 2 commits into
Open
shehabgamin wants to merge 2 commits into
shehabgamin wants to merge 2 commits into
Conversation
FIRST_VALUE scalars during merge
kumarUjjawal
approved these changes
Oct 25, 2026
kumarUjjawal
left a comment
Contributor
There was a problem hiding this comment.
Thank you @shehabgamin
Looks good 👍
Contributor
|
Thanks @shehabgamin and @kumarUjjawal Is there any way we can get a .slt / sql end user API repro for this? |
Contributor
|
The reproducer in #26744 (comment) is probably a good start |
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?
Closes #26744.
Rationale for this change
DISTINCT ONqueries carrying nested payloads can fail with a memory reservation error during aggregate spill/replay because mergedFIRST_VALUEstates retain backing buffers from larger arrays.What changes are included in this PR?
Call
self.first.compact()after extracting the selected scalar inTrivialFirstValueAccumulator::merge_batch, matching the existing behavior inupdate_batch.What is the testing strategy for this PR?
Locally validated against unpatched and patched DataFusion 55.2.0. An accumulator regression check confirms that merging a list state preserves its value and reports the same memory size as updating it directly; it fails before the fix and passes afterward.
The spill workload described in #26744 fails before the fix and returns all 8,192 rows with correct nested payloads afterward, while still exercising spilling.
Are there any user-facing changes?
No.