Skip to content

branch-4.1: [fix](eagerAgg) Fix eager aggregation incorrectly pushing agg(literal) to nullable side of outer joins #62107#62456

Open
github-actions[bot] wants to merge 2 commits into
branch-4.1from
auto-pick-62107-branch-4.1
Open

branch-4.1: [fix](eagerAgg) Fix eager aggregation incorrectly pushing agg(literal) to nullable side of outer joins #62107#62456
github-actions[bot] wants to merge 2 commits into
branch-4.1from
auto-pick-62107-branch-4.1

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Cherry-picked from #62107

@github-actions github-actions Bot requested a review from yiguolei as a code owner April 13, 2026 14:25
@Thearas
Copy link
Copy Markdown
Contributor

Thearas commented Apr 13, 2026

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@dataroaring dataroaring reopened this Apr 13, 2026
@Thearas
Copy link
Copy Markdown
Contributor

Thearas commented Apr 13, 2026

run buildall

1 similar comment
@englefly
Copy link
Copy Markdown
Contributor

run buildall

englefly added 2 commits May 25, 2026 10:01
…) to nullable side of outer joins (#62107)

### What problem does this PR solve?

Issue Number: close #xxx

Problem Summary:
The EagerAggRewriter only blocked count(*)/count(literal) from being
pushed to the nullable side of outer joins (via instanceof Count check).
But the same logic applies to ALL aggregate functions whose input slots
do not reference columns from the target side, e.g. sum(2), min(1),
max(3).

For unmatched rows in outer joins, these aggregates should produce their
literal-based result (e.g. sum(2) adds 2 per unmatched row). After
incorrect pushdown to the nullable side, the pre-aggregated slot becomes
NULL for unmatched rows, and sum(NULL)/min(NULL)/max(NULL) loses the
contribution entirely.

The fix generalizes the existing Count-only guard to all aggregate
functions: for any agg function with no input slots from the target
side, block pushdown to the nullable side of outer joins.
agg(nullable_side_col) is still safe to push because NULL values are
naturally handled by aggregates.
@englefly englefly force-pushed the auto-pick-62107-branch-4.1 branch from 15c10d0 to 4dd4503 Compare May 25, 2026 02:10
@englefly
Copy link
Copy Markdown
Contributor

run buildall

@hello-stephen
Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 69.23% (9/13) 🎉
Increment coverage report
Complete coverage report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants