perf: use columnar state for ordered ARRAY_AGG and STRING_AGG - #24392
Open
lyne7-sc wants to merge 6 commits into
Open
perf: use columnar state for ordered ARRAY_AGG and STRING_AGG#24392lyne7-sc wants to merge 6 commits into
ARRAY_AGG and STRING_AGG#24392lyne7-sc wants to merge 6 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #24392 +/- ##
==========================================
+ Coverage 81.14% 81.19% +0.04%
==========================================
Files 1110 1110
Lines 386137 389248 +3111
Branches 386137 389248 +3111
==========================================
+ Hits 313347 316047 +2700
- Misses 54324 54544 +220
- Partials 18466 18657 +191 ☔ 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
Ordered
ARRAY_AGGandSTRING_AGGcurrently have high memory and sorting overhead for large inputs.This is relevant to #20788, where removing
ORDER BYfrom severalARRAY_AGGexpressions avoids the reported memory explosion. This PR improves the orderedARRAY_AGGandSTRING_AGGaccumulators.What changes are included in this PR?
This PR changes the ordered aggregate accumulator to:
RowConverter.interleaveor a zero-copy slice.The accumulator is shared by ordered
ARRAY_AGGandSTRING_AGG.Are these changes tested?
Yes. Unit and SQL logic tests cover ordering, partial-state merging, NULL handling, and type preservation.
Are there any user-facing changes?
No. This is an internal performance optimization
Benchmarks
Benchmark coverage is added in #24391.
ARRAY_AGGARRAY_AGGexpressionsSTRING_AGG