Skip to content

branch-4.1: [fix](preagg) Enable pre-aggregation for multi-argument aggregate functions with all-key distinct inputs #65846 - #66676

Open
github-actions[bot] wants to merge 1 commit into
branch-4.1from
auto-pick-65846-branch-4.1
Open

branch-4.1: [fix](preagg) Enable pre-aggregation for multi-argument aggregate functions with all-key distinct inputs #65846#66676
github-actions[bot] wants to merge 1 commit into
branch-4.1from
auto-pick-65846-branch-4.1

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Cherry-picked from #65846

…ctions with all-key distinct inputs (#65846)

### What problem does this PR solve?

Issue Number: close #xxx

Related PR: #48502

Problem Summary:
When an aggregate function has more than one child expression (e.g.,
[count(distinct k6,
v7)](vscode-file://vscode-app/usr/share/code/resources/app/out/vs/code/electron-browser/workbench/workbench.html)),
the pre-aggregation status check previously only handled the cases of
zero children or exactly one child. Multi-child aggregate functions fell
through to the else branch that attempted to process them via
[checkAggWithKeyAndValueSlots](vscode-file://vscode-app/usr/share/code/resources/app/out/vs/code/electron-browser/workbench/workbench.html),
which is designed for single aggregate functions with complex
expressions like IF/CASE WHEN — not for genuinely multi-parameter
aggregate functions. This could lead to incorrect pre-aggregation
decisions for functions like COUNT(DISTINCT col1, col2).

This fix explicitly only enable pre-aggregation for multi-argument
aggregate functions with all-key distinct inputs, and reject other
multi-argument aggregate functions.

None
@github-actions
github-actions Bot requested a review from yiguolei as a code owner August 12, 2026 03:02
@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?

@hello-stephen

Copy link
Copy Markdown
Contributor

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 51.75% (74/143) 🎉
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