Skip to content

branch-3.0: [fix](nereids) fix rewrite avg to sum / count change nullable #53787#53862

Closed
github-actions[bot] wants to merge 1 commit intobranch-3.0from
auto-pick-53787-branch-3.0
Closed

branch-3.0: [fix](nereids) fix rewrite avg to sum / count change nullable #53787#53862
github-actions[bot] wants to merge 1 commit intobranch-3.0from
auto-pick-53787-branch-3.0

Conversation

@github-actions
Copy link
Contributor

Cherry-picked from #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 #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 github-actions bot requested a review from dataroaring as a code owner July 24, 2025 11:55
@Thearas
Copy link
Contributor

Thearas commented Jul 24, 2025

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?

@dataroaring dataroaring reopened this Jul 24, 2025
@Thearas
Copy link
Contributor

Thearas commented Jul 24, 2025

run buildall

@hello-stephen
Copy link
Contributor

FE UT Coverage Report

Increment line coverage 0.00% (0/4) 🎉
Increment coverage report
Complete coverage report

@morrySnow morrySnow closed this Jul 25, 2025
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.

5 participants