[fix](eager-agg) Handle duplicate aggregate functions pushed through projects - #66531
Open
feiniaofeiafei wants to merge 4 commits into
Open
[fix](eager-agg) Handle duplicate aggregate functions pushed through projects#66531feiniaofeiafei wants to merge 4 commits into
feiniaofeiafei wants to merge 4 commits into
Conversation
feiniaofeiafei
requested review from
924060929,
englefly,
morrySnow and
starocean999
as code owners
August 6, 2026 06:30
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Collaborator
Author
|
run buildall |
Contributor
FE Regression Coverage ReportIncrement line coverage |
Collaborator
Author
|
run buildall |
Contributor
TPC-H: Total hot run time: 28827 ms |
Contributor
TPC-DS: Total hot run time: 166510 ms |
Contributor
ClickBench: Total hot run time: 23.7 s |
Contributor
FE Regression Coverage ReportIncrement line coverage |
englefly
reviewed
Aug 8, 2026
| } | ||
| boolean needDifferentExprId = aggFunctions.size() != context.getAliasMap().size(); |
Contributor
There was a problem hiding this comment.
这一轮遍历可以省略, 判断去重可以在 L429 这个 for 循环里一次完成
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?
Related PR: #63690
Problem Summary:
Eager aggregation pushdown may fail when different aggregate functions become
the same expression after passing through a Project. report error:
For example:
After pushing the aggregates through the Project, both functions become
SUM(0):Because
aliasMapuses expression equality, only one entry is retained.The Project still tries to read both
#4and#5fromBilateralState,causing a null lookup.
This PR deduplicates the child aggregate and records the ExprId mapping:
The Project then restores both required outputs:
When no aggregate functions are merged, the original ExprIds are reused to
avoid unnecessary aliases.
The same fix also covers cases such as:
where
SUM(x)andSUM(y)both becomeSUM(a#1)after pushdown.Release note
None
Check List (For Author)
Test
query_p0/eager_agg/bilateral_eager_aggProject pushdown.
Behavior changed:
aggregate functions become identical after Project rewriting.
eager_aggregation_mode=1can force eligible pushdown after a UNION.Does this need documentation?
Check List (For Reviewer who merge this PR)