Fix aggregated projections#90288
Merged
antaljanosbenjamin merged 9 commits intomasterfrom Nov 24, 2025
Merged
Conversation
Contributor
|
Workflow [PR], commit [833d2df] Summary: ❌
|
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug in aggregated projection optimization where virtual columns were being added incorrectly to the ActionsDAG, causing crashes or incorrect behavior in certain queries involving projections with joins and window functions.
Key changes:
- Modified how virtual columns are added to the ActionsDAG in projection optimization to use name and type separately instead of passing a NameAndTypePair object
- Added a temporary safeguard in ActionsDAG::addNode to prevent invalid column objects from being stored
- Added a regression test with a complex query involving CTEs, window functions, and joins
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/Processors/QueryPlan/Optimizations/optimizeUseAggregateProjection.cpp | Fixed virtual column input addition to use separate name and type parameters |
| src/Interpreters/ActionsDAG.cpp | Added validation to clear invalid column objects in non-placeholder nodes |
| tests/queries/0_stateless/03721_aggregate_projection_actions_dag.sql | Added regression test with complex query involving CTEs, window functions and joins |
| tests/queries/0_stateless/03721_aggregate_projection_actions_dag.reference | Expected output showing the query plan structure |
KochetovNicolai
approved these changes
Nov 20, 2025
Member
Author
|
Member
Author
|
Member
Author
|
Test failures are not related. |
robot-ch-test-poll3
added a commit
that referenced
this pull request
Nov 24, 2025
Cherry pick #90288 to 25.9: Fix aggregated projections
robot-clickhouse
added a commit
that referenced
this pull request
Nov 24, 2025
This was referenced Nov 24, 2025
robot-ch-test-poll3
added a commit
that referenced
this pull request
Nov 24, 2025
Cherry pick #90288 to 25.10: Fix aggregated projections
robot-clickhouse
added a commit
that referenced
this pull request
Nov 24, 2025
This was referenced Nov 24, 2025
robot-ch-test-poll3
added a commit
that referenced
this pull request
Nov 24, 2025
Cherry pick #90288 to 25.11: Fix aggregated projections
robot-clickhouse
added a commit
that referenced
this pull request
Nov 24, 2025
nikitamikhaylov
added a commit
that referenced
this pull request
Nov 24, 2025
Backport #90288 to 25.10: Fix aggregated projections
antaljanosbenjamin
added a commit
that referenced
this pull request
Nov 26, 2025
Backport #90288 to 25.11: Fix aggregated projections
clickhouse-gh bot
added a commit
that referenced
this pull request
Nov 26, 2025
Backport #90288 to 25.9: Fix aggregated projections
1 task
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.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix some queries with aggregated projection optimization.
Documentation entry for user-facing changes