Skip to content

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

Open
englefly wants to merge 1 commit into
apache:branch-4.1from
englefly:pick-62107-4.1
Open

branch-4.1: [fix](eagerAgg) Fix eager aggregation incorrectly pushing agg(literal) to nullable side of outer joins #62107#63575
englefly wants to merge 1 commit into
apache:branch-4.1from
englefly:pick-62107-4.1

Conversation

@englefly
Copy link
Copy Markdown
Contributor

@englefly englefly commented May 25, 2026

pick #62107

@englefly englefly requested a review from yiguolei as a code owner May 25, 2026 03:44
@englefly
Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen
Copy link
Copy Markdown
Contributor

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?

@englefly englefly changed the title [fix](eagerAgg) Fix eager aggregation incorrectly pushing agg(literal) to nullable side of outer joins (#62107) branch-4.1 [fix](eagerAgg) Fix eager aggregation incorrectly pushing agg(literal) to nullable side of outer joins (#62107) May 25, 2026
@morrySnow morrySnow changed the title branch-4.1 [fix](eagerAgg) Fix eager aggregation incorrectly pushing agg(literal) to nullable side of outer joins (#62107) branch-4.1: [fix](eagerAgg) Fix eager aggregation incorrectly pushing agg(literal) to nullable side of outer joins #62107 May 25, 2026
@hello-stephen
Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 7.09% (9/127) 🎉
Increment coverage report
Complete coverage report

…) to nullable side of outer joins (apache#62107)

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.

case
@englefly
Copy link
Copy Markdown
Contributor Author

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.

2 participants