BiteTheDDDDt opened a new pull request, #57913:
URL: https://github.com/apache/doris/pull/57913
### What problem does this PR solve?
This pull request refines the logic for detecting aggregate columns in
materialized view creation, particularly in the context of different key types.
The main change is that the `hasAggregateSlot` method now considers the
materialized view's key type, which improves accuracy when checking for
unsupported aggregate columns in WHERE clauses. The test suite is also updated
to cover scenarios involving unique keys.
### Improvements to aggregate column detection:
* Updated the `hasAggregateSlot` method in `Expr` and its override in
`SlotRef` to accept a `KeysType` parameter, allowing the method to behave
differently based on the key type of the materialized view.
[[1]](diffhunk://#diff-3e99dac63876f0ebe0fda8e9a3f96344ba41dd07a3681216000917a83775582fL2274-R2276)
[[2]](diffhunk://#diff-62876d1360b534ad5409ed9a63ee9b86a8db5bbef054457ebe78fd81e0402525L502-R508)
* Modified calls to `hasAggregateSlot` in `CreateMaterializedViewStmt` to
pass the current materialized view key type, ensuring correct validation logic
for WHERE clauses and column definitions.
[[1]](diffhunk://#diff-1575b94f070958cfb28ae1e9621282b309cb069e170f7958045546e2e628daa2L228-R228)
[[2]](diffhunk://#diff-1575b94f070958cfb28ae1e9621282b309cb069e170f7958045546e2e628daa2L585-R585)
### Test coverage enhancements:
* Added new test cases in `k123.groovy` to validate materialized view
creation with unique keys and ensure that aggregate columns in WHERE clauses
are correctly detected and rejected.
### Check List (For Author)
- Test <!-- At least one of them must be included. -->
- [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 <!-- Add your reason? -->
- Behavior changed:
- [x] No.
- [ ] Yes. <!-- Explain the behavior change -->
- Does this need documentation?
- [x] No.
- [ ] Yes. <!-- Add document PR link here. eg:
https://github.com/apache/doris-website/pull/1214 -->
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label <!-- Add branch pick label that this PR should
merge into -->
--
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]