Uh oh!
There was an error while loading. Please reload this page.
branch-2.1: [fix](nereids) do eliminate constant group by key in normalizeagg #49589 - #50212
Merged
Merged
Conversation
hello-stephen
commented
Apr 21, 2025
Contributor
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
feiniaofeiafei
commented
Apr 21, 2025
CollaboratorAuthor
run buildall |
feiniaofeiafei
commented
Apr 21, 2025
CollaboratorAuthor
run buildall |
1 similar comment
feiniaofeiafei
commented
May 7, 2025
CollaboratorAuthor
run buildall |
…ache#49589) Related PR: apache#32878apache#49473 Problem Summary: SELECT IF( t.`gender` IN ('女'), ( TIMESTAMPDIFF( YEAR, NOW(), NOW() ) ), 1 ) AS x0, TIMESTAMPDIFF( YEAR, NOW(), NOW() ) AS x1 FROM t1 AS t GROUP BY x0, x1; after EliminateGroupByConstant, this sql will be rewritten to SELECT IF( t.`gender` IN ('女'), 0, 1 ) AS x0, 0 AS x1 FROM t1 AS t GROUP BY IF( t.`gender` IN ('女'), ( TIMESTAMPDIFF( YEAR, NOW(), NOW() ) ), 1 ) ; The select expression and the group by expression is different, and will report error in normalizeagg. The fix in PR apache#49473 may introduce another issue. Consider the following query: SELECT func2(100) FROM t GROUP BY func1(), func2(func1()); If func1() can be constant-folded to 100, then func2(func1()) will be replaced with func2(100), allowing the query to execute successfully. However, when func1() cannot be folded to 100, the query will fail. This creates an inconsistent behavior where query execution depends on whether func1() can be constant-folded or not, which is not an ideal implementation. To address this issue, this PR modifies the normalizeAgg logic to eliminate constant group by keys. With this change, the query will consistently fail regardless of whether func1() can be folded or not, ensuring more predictable behavior.
feiniaofeiafeiforce-pushed
the
pick_normalize
branch
from
May 8, 2025 01:56
ba05d4b to
8b610b3Comparefeiniaofeiafei
commented
May 8, 2025
CollaboratorAuthor
run buildall |
feiniaofeiafei
commented
May 8, 2025
CollaboratorAuthor
run p0 |
1 similar comment
feiniaofeiafei
commented
May 8, 2025
CollaboratorAuthor
run p0 |
yiguolei
approved these changes
May 8, 2025
GoGoWen pushed a commit
to GoGoWen/incubator-doris
that referenced
this pull request
Sep 26, 2025
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.
Cherry-picked from #49589