-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[fix](nereids) fix rewrite avg to sum / count change nullable #53787
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
morrySnow
merged 1 commit into
apache:master
from
yujun777:fix-adjust-nullable-check-fail
Jul 24, 2025
Merged
[fix](nereids) fix rewrite avg to sum / count change nullable #53787
morrySnow
merged 1 commit into
apache:master
from
yujun777:fix-adjust-nullable-check-fail
Jul 24, 2025
Conversation
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
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
Author
|
run buildall |
TPC-H: Total hot run time: 34883 ms |
cc2d5b1 to
e0b7d74
Compare
Contributor
Author
|
run buildall |
TPC-H: Total hot run time: 33986 ms |
e0b7d74 to
d06eea6
Compare
TPC-DS: Total hot run time: 187545 ms |
ClickBench: Total hot run time: 32.58 s |
morrySnow
approved these changes
Jul 24, 2025
Contributor
|
PR approved by at least one committer and no changes requested. |
Contributor
|
PR approved by anyone and no changes requested. |
Contributor
|
run buildall |
TPC-H: Total hot run time: 34710 ms |
TPC-DS: Total hot run time: 188496 ms |
ClickBench: Total hot run time: 32.86 s |
Contributor
|
run check_coverage |
feiniaofeiafei
approved these changes
Jul 24, 2025
github-actions bot
pushed a commit
that referenced
this pull request
Jul 24, 2025
### What problem does this PR solve? for sql select avg(distinct a), sum(distinct b) from t group by c if "a" is not nullable, then "avg" is not nullable, AvgDistinctToSumDivCount will rewrite "avg" to "sum(distinct a) / count(distinct a)", but the divide "/" is nullable, then AdjustNullable will throw exception for this changed nullable (introduced by #52748): "AdjustNullable convert slot avg(..)#10 from not-nullable to nullable. You can disable check by set fe_debug = false." need add a nonNullable function to make the rewritten expression not-nullable.
github-actions bot
pushed a commit
that referenced
this pull request
Jul 24, 2025
### What problem does this PR solve? for sql select avg(distinct a), sum(distinct b) from t group by c if "a" is not nullable, then "avg" is not nullable, AvgDistinctToSumDivCount will rewrite "avg" to "sum(distinct a) / count(distinct a)", but the divide "/" is nullable, then AdjustNullable will throw exception for this changed nullable (introduced by #52748): "AdjustNullable convert slot avg(..)#10 from not-nullable to nullable. You can disable check by set fe_debug = false." need add a nonNullable function to make the rewritten expression not-nullable.
yujun777
added a commit
to yujun777/doris
that referenced
this pull request
Jul 24, 2025
…#53787) ### What problem does this PR solve? for sql select avg(distinct a), sum(distinct b) from t group by c if "a" is not nullable, then "avg" is not nullable, AvgDistinctToSumDivCount will rewrite "avg" to "sum(distinct a) / count(distinct a)", but the divide "/" is nullable, then AdjustNullable will throw exception for this changed nullable (introduced by apache#52748): "AdjustNullable convert slot avg(..)apache#10 from not-nullable to nullable. You can disable check by set fe_debug = false." need add a nonNullable function to make the rewritten expression not-nullable.
w41ter
pushed a commit
to w41ter/incubator-doris
that referenced
this pull request
Jul 30, 2025
…#53787) ### What problem does this PR solve? for sql select avg(distinct a), sum(distinct b) from t group by c if "a" is not nullable, then "avg" is not nullable, AvgDistinctToSumDivCount will rewrite "avg" to "sum(distinct a) / count(distinct a)", but the divide "/" is nullable, then AdjustNullable will throw exception for this changed nullable (introduced by apache#52748): "AdjustNullable convert slot avg(..)apache#10 from not-nullable to nullable. You can disable check by set fe_debug = false." need add a nonNullable function to make the rewritten expression not-nullable.
zhiqiang-hhhh
pushed a commit
to zhiqiang-hhhh/doris
that referenced
this pull request
Aug 4, 2025
…#53787) ### What problem does this PR solve? for sql select avg(distinct a), sum(distinct b) from t group by c if "a" is not nullable, then "avg" is not nullable, AvgDistinctToSumDivCount will rewrite "avg" to "sum(distinct a) / count(distinct a)", but the divide "/" is nullable, then AdjustNullable will throw exception for this changed nullable (introduced by apache#52748): "AdjustNullable convert slot avg(..)apache#10 from not-nullable to nullable. You can disable check by set fe_debug = false." need add a nonNullable function to make the rewritten expression not-nullable.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
What problem does this PR solve?
for sql
select avg(distinct a), sum(distinct b) from t group by c, ifais not nullable, thenavgis not nullable,AvgDistinctToSumDivCount will rewrite
avgtosum(distinct a) / count(distinct a), but the divide '/' is nullable,then AdjustNullable will throw exception for this changed nullable (introduced by #52748):
need add a nonNullable function to make the rewritten expression not-nullable.
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)