Uh oh!
There was an error while loading. Please reload this page.
[opt](nereids)use SetPreAggStatus rule instead of AdjustPreAggStatus with join limited - #48502
Merged
Conversation
Thearas
commented
Mar 1, 2025
Contributor
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
starocean999
commented
Mar 1, 2025
ContributorAuthor
run buildall |
doris-robot
commented
Mar 1, 2025
TPC-H: Total hot run time: 31861 ms |
Closed
16 tasks
doris-robot
commented
Mar 1, 2025
TPC-DS: Total hot run time: 190880 ms |
doris-robot
commented
Mar 1, 2025
ClickBench: Total hot run time: 31.27 s |
starocean999
commented
Mar 3, 2025
ContributorAuthor
run buildall |
doris-robot
commented
Mar 3, 2025
TPC-H: Total hot run time: 30473 ms |
doris-robot
commented
Mar 3, 2025
TPC-DS: Total hot run time: 45834 ms |
doris-robot
commented
Mar 3, 2025
ClickBench: Total hot run time: 30.92 s |
starocean999
commented
Mar 3, 2025
ContributorAuthor
run buildall |
doris-robot
commented
Mar 3, 2025
TPC-H: Total hot run time: 30510 ms |
doris-robot
commented
Mar 3, 2025
TPC-DS: Total hot run time: 56958 ms |
doris-robot
commented
Mar 3, 2025
ClickBench: Total hot run time: 30.34 s |
starocean999
commented
Mar 3, 2025
ContributorAuthor
run buildall |
doris-robot
commented
Mar 3, 2025
TPC-H: Total hot run time: 31653 ms |
doris-robot
commented
Mar 3, 2025
TPC-DS: Total hot run time: 184860 ms |
doris-robot
commented
Mar 3, 2025
ClickBench: Total hot run time: 31.38 s |
starocean999
commented
Mar 3, 2025
ContributorAuthor
run buildall |
doris-robot
commented
Mar 3, 2025
TPC-H: Total hot run time: 31476 ms |
doris-robot
commented
Mar 3, 2025
TPC-DS: Total hot run time: 190613 ms |
doris-robot
commented
Mar 3, 2025
ClickBench: Total hot run time: 30.3 s |
starocean999
commented
Mar 7, 2025
ContributorAuthor
run buildall |
doris-robot
commented
Mar 7, 2025
TPC-H: Total hot run time: 32930 ms |
doris-robot
commented
Mar 7, 2025
TPC-DS: Total hot run time: 185347 ms |
doris-robot
commented
Mar 7, 2025
ClickBench: Total hot run time: 31.09 s |
starocean999
marked this pull request as ready for review
March 7, 2025 11:34
starocean999
commented
May 12, 2025
ContributorAuthor
run buildall |
doris-robot
commented
May 12, 2025
TPC-H: Total hot run time: 34001 ms |
doris-robot
commented
May 12, 2025
TPC-DS: Total hot run time: 186346 ms |
doris-robot
commented
May 12, 2025
ClickBench: Total hot run time: 29.12 s |
924060929
commented
May 13, 2025
Contributor
good refactor, more clear |
morrySnow
approved these changes
May 13, 2025
924060929
approved these changes
May 13, 2025
Contributor
PR approved by at least one committer and no changes requested. |
Contributor
PR approved by anyone and no changes requested. |
koarz pushed a commit
to koarz/doris
that referenced
this pull request
Jun 4, 2025
…with join limited (apache#48502) The old AdjustPreAggStatus rule can't set preagg open if there is a join node under agg node. But in some senario, the preagg can be set to open as bellow: ``` agg (sum(t1.a),max(t2.a)) |- join |- t1 PREAGG ON (The data produced by join has no impact on max(t2.a)) |- t2 PREAGG OFF(The data produced by join will make sum(t1.a) incorrect, so the preagg is set to off) ``` The new SetPreAggStatus rule is enhanced to handle such case
16 tasks
morrySnow pushed a commit
that referenced
this pull request
Jul 8, 2026
…ad of bottom-up from scan in SetPreAggStatus (#65237) related pr: #48502 Problem Summary: The `SetPreAggStatus` rule previously created `PreAggInfoContext` at `LogicalOlapScan` nodes (bottom-up): the first encountered AGG_KEYS scan pushed a new context onto the stack, subsequent scans and intermediate nodes (filter/join/project) filled in information, and `LogicalAggregate` popped and consumed the context. This bottom-up approach had two issues: 1. **Nested aggregate information loss**: When a query contains nested aggregates (e.g., an outer aggregate over an inner aggregate), the inner aggregate's `visitLogicalAggregate` would pop the only context on the stack, leaving the outer aggregate with no context for scans directly under it. 2. **Unclear context ownership**: Context lifecycle was split across scan (creation) and aggregate (consumption), making the ownership boundary implicit and fragile — intermediate plan nodes that call `context.clear()` via the base `visit()` method could inadvertently destroy the context. This PR refactors the context propagation to a **top-down** model: - `visitLogicalAggregate` now creates a fresh `PreAggInfoContext`, pushes it onto the stack, visits children, then pops and stores it. - `visitLogicalOlapScan` only fills relation IDs into an existing context; it no longer creates contexts. - The `retainAll` filtering is no longer needed since each aggregate creates its own isolated context with only the scan IDs from its subtree. - Nested aggregates each get their own independent context, correctly isolating preagg information per aggregate level.
github-actionsBot
pushed a commit
that referenced
this pull request
Jul 8, 2026
…ad of bottom-up from scan in SetPreAggStatus (#65237) related pr: #48502 Problem Summary: The `SetPreAggStatus` rule previously created `PreAggInfoContext` at `LogicalOlapScan` nodes (bottom-up): the first encountered AGG_KEYS scan pushed a new context onto the stack, subsequent scans and intermediate nodes (filter/join/project) filled in information, and `LogicalAggregate` popped and consumed the context. This bottom-up approach had two issues: 1. **Nested aggregate information loss**: When a query contains nested aggregates (e.g., an outer aggregate over an inner aggregate), the inner aggregate's `visitLogicalAggregate` would pop the only context on the stack, leaving the outer aggregate with no context for scans directly under it. 2. **Unclear context ownership**: Context lifecycle was split across scan (creation) and aggregate (consumption), making the ownership boundary implicit and fragile — intermediate plan nodes that call `context.clear()` via the base `visit()` method could inadvertently destroy the context. This PR refactors the context propagation to a **top-down** model: - `visitLogicalAggregate` now creates a fresh `PreAggInfoContext`, pushes it onto the stack, visits children, then pops and stores it. - `visitLogicalOlapScan` only fills relation IDs into an existing context; it no longer creates contexts. - The `retainAll` filtering is no longer needed since each aggregate creates its own isolated context with only the scan IDs from its subtree. - Nested aggregates each get their own independent context, correctly isolating preagg information per aggregate level.
16 tasks
englefly pushed a commit
that referenced
this pull request
Aug 12, 2026
…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-actionsBot
pushed a commit
that referenced
this pull request
Aug 12, 2026
…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
wyxxxcat pushed a commit
to wyxxxcat/doris
that referenced
this pull request
Aug 17, 2026
…ctions with all-key distinct inputs (apache#65846) ### What problem does this PR solve? Issue Number: close #xxx Related PR: apache#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
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 freeto 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.
The old AdjustPreAggStatus rule can't set preagg open if there is a join node under agg node. But in some senario, the preagg can be set to open as bellow:
The new SetPreAggStatus rule is enhanced to handle such case
What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)