[fix](be) Preserve collect aggregate limit during merge#63361
Merged
Conversation
### What problem does this PR solve?
Issue Number: DORIS-25679
Related PR: N/A
Problem Summary: collect_list and collect_set aggregate states with a limit could lose their initialized max_size during merge because several merge paths overwrote the left state max_size with the right state unconditionally. If the right state was still uninitialized, later merge/add operations could ignore the requested limit.
### Release note
None
### Check List (For Author)
- Test: Unit Test
- build-support/clang-format.sh
- build-support/check-format.sh
- ./run-be-ut.sh --run --filter=VAggCollectTest.*:AggregateFunctionCollectTest.*
- build-support/run-clang-tidy.sh --build-dir be/ut_build_ASAN (failed: local clang-tidy could not analyze due to missing stddef.h in the toolchain include path and an existing unmatched NOLINTEND diagnostic in be/src/core/types.h)
- Behavior changed: Yes. collect_list/collect_set merge preserves an initialized max_size limit instead of overwriting it with an uninitialized right-side state.
- Does this need documentation: No
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Member
Author
|
/review |
Contributor
There was a problem hiding this comment.
Review result: no blocking issues found.
Critical checkpoint conclusions:
- Goal and proof: The change preserves an already-initialized collect_list/collect_set limit during aggregate-state merge, and the added BE unit test exercises the affected limited merge variants.
- Scope: The code change is small and focused; it removes only the unconditional rhs max_size overwrite and keeps surrounding merge behavior unchanged.
- Concurrency/lifecycle: The touched aggregate state merge paths do not introduce shared state, new threads, static initialization, or lifecycle ownership changes.
- Config/compatibility/protocol: No configuration, storage format, FE-BE protocol, or rolling-upgrade compatibility concern was introduced. Serialized state layout is unchanged.
- Parallel paths: The affected string/list/complex limited merge paths were updated consistently; unaffected no-limit paths remain unchanged.
- Tests: Targeted BE unit coverage was added. I did not run tests in this review environment.
- Observability/transactions/data writes: Not applicable; this is local aggregate-state behavior with no transaction, persistence, or logging surface change.
- Performance: No new hot-path overhead was added; the merge paths avoid additional allocations beyond existing insertion behavior.
User focus: No additional user-provided review focus was present.
Member
Author
|
run buildall |
Contributor
TPC-H: Total hot run time: 30894 ms |
Contributor
TPC-DS: Total hot run time: 168492 ms |
Contributor
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
Contributor
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
github-actions Bot
pushed a commit
that referenced
this pull request
May 19, 2026
Problem Summary: collect_list and collect_set aggregate states with a
limit could lose their initialized max_size during merge because several
merge paths overwrote the left state max_size with the right state
unconditionally. If the right state was still uninitialized, later
merge/add operations could ignore the requested limit.
### Release note
None
### Check List (For Author)
- Test: Unit Test
- build-support/clang-format.sh
- build-support/check-format.sh
- ./run-be-ut.sh --run
--filter=VAggCollectTest.*:AggregateFunctionCollectTest.*
- build-support/run-clang-tidy.sh --build-dir be/ut_build_ASAN (failed:
local clang-tidy could not analyze due to missing stddef.h in the
toolchain include path and an existing unmatched NOLINTEND diagnostic in
be/src/core/types.h)
- Behavior changed: Yes. collect_list/collect_set merge preserves an
initialized max_size limit instead of overwriting it with an
uninitialized right-side state.
- Does this need documentation: No
yiguolei
pushed a commit
that referenced
this pull request
May 20, 2026
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.
What problem does this PR solve?
Issue Number: DORIS-25679
Related PR: N/A
Problem Summary: collect_list and collect_set aggregate states with a limit could lose their initialized max_size during merge because several merge paths overwrote the left state max_size with the right state unconditionally. If the right state was still uninitialized, later merge/add operations could ignore the requested limit.
Release note
None
Check List (For Author)