[opt](function) optimize array aggregate execution#64913
Draft
Mryange wants to merge 1 commit into
Draft
Conversation
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: 29083 ms |
Contributor
TPC-DS: Total hot run time: 171078 ms |
Contributor
ClickBench: Total hot run time: 25.39 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.
What problem does this PR solve?
Array aggregate functions such as
array_avg,array_sum,array_min,array_max, andarray_productpreviously evaluated each array by creating and driving the generic aggregate-function path. This added unnecessary per-row aggregate state, arena, nullable wrapper, and virtual-call overhead for simple array-local reductions.Root cause: array aggregation reused the general aggregate-function execution machinery even though these functions only need a small per-row reduction state over the nested array data.
This change adds a direct
ColumnArrayViewbased fast path with lightweightArrayAggStatereducers for sum, avg, min, max, and product. DecimalV3 sum/avg/product keep using the FE-planned result type and scale, while ordinary array-mapped functions now trust the FE return type instead of reconstructing a BE-side aggregate function only for return-type checking.Local optest result for
array/array_avg_arrimproved from about 1.685s to 0.85-0.91s in warm runs.Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)