morrySnow opened a new pull request, #67666:
URL: https://github.com/apache/doris/pull/67666
### What problem does this PR solve?
Issue Number: None
Related PR: None
Problem Summary:
DISTINCT window rewrites for SUM and GROUP_CONCAT manually reconstructed
their multi-distinct functions with the default non-nullable flag. For empty
window frames over NOT NULL inputs, the backend consequently materialized empty
aggregate states (0 or an empty string) instead of NULL.
This change reuses each aggregate function's canonical multi-distinct
conversion, preserving the always-nullable contract established during
window-function analysis. COUNT(DISTINCT) behavior remains unchanged.
### Release note
Fix SUM(DISTINCT ...) and GROUP_CONCAT(DISTINCT ...) window functions to
return NULL for empty frames.
### Check List (For Author)
- Test
- [x] Regression test
- [ ] Unit Test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test or manual test. Explain why:
- [ ] This is a refactor/code format and no logic has been changed.
- [ ] Previous test can cover this change.
- [ ] No code files have been changed.
- [ ] Other reason
Regression test: `multi_distinct_window`, run against the local sandbox FE
on port 9435.
- Behavior changed:
- [ ] No.
- [x] Yes. Empty frames now return NULL for SUM(DISTINCT ...) and
GROUP_CONCAT(DISTINCT ...); COUNT(DISTINCT ...) continues to return 0.
- Does this need documentation?
- [x] No.
- [ ] Yes.
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]