Conversation
### What problem does this PR solve? Issue Number: N/A Related PR: apache#67439 Problem Summary: Single-value aggregate states duplicated storage logic, while first_value, last_value, nth_value, lead, and lag retained raw input column references that could outlive reclaimed input columns. Introduce reusable fixed-width, string, and owned-column state implementations, reuse them across min/max, min_by/max_by, any, and window value functions, and keep complex window types on non-incremental evaluation when equality comparison is unsupported. ### Release note Fix single-value window functions retaining references to reclaimed input columns. ### Check List (For Author) - Test: Unit Test - ./run-be-ut.sh --run --filter=SingleValueDataStringTest.*:SingleValueDataColumnTest.* -j 48 (18 tests passed under ASAN) - Behavior changed: Yes. Window states now own selected values instead of retaining raw input column references. - Does this need documentation: No
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
Author
|
run buildall |
Contributor
TPC-H: Total hot run time: 27815 ms |
Contributor
TPC-DS: Total hot run time: 153951 ms |
Contributor
ClickBench: Total hot run time: 23.81 s |
Contributor
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
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.
Single-value aggregate state implementations were duplicated across aggregate functions, and complex values were not handled consistently. In particular, window functions such as
first_value,last_value,nth_value,lead, andlagretained a raw input column pointer and row offset. The input column can be cleared while the window state is still alive, leaving the state with an invalid reference.Root cause: the shared state abstraction did not own complex values, so aggregate functions either maintained separate implementations or referenced input columns directly.
This change introduces reusable fixed-width, string, and owned-column single-value states. The column-backed state materializes exactly one selected row and is reused by complex
min,max,min_by,max_by, and window value functions. Unsupported complex comparison types use non-incremental window evaluation. Existing fixed-width and string state serialization formats are preserved.Tests cover value ownership after source-column reclamation, comparison and serialization, and verify that retained column allocation does not scale with the number of source rows.
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)