[opt](mtmv) Doesn't throw npe when not set distribution info which should be random (#49402)

### What problem does this PR solve?

pr: https://github.com/apache/doris/pull/39427
commitId: 9ffb060a



Issue Number: close #xxx

Related PR: #xxx

Problem Summary:

### Release note

None

### Check List (For Author)

- Test <!-- At least one of them must be included. -->
    - [ ] 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:
    - [ ] No.
    - [ ] Yes. <!-- Explain the behavior change -->

- Does this need documentation?
    - [ ] 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 commit is contained in:
seawinde
2025-04-21 10:41:07 +08:00
committed by GitHub
parent 481fca6766
commit 01b5cc4f1f
3 changed files with 166 additions and 2 deletions

View File

@ -655,7 +655,12 @@ public class LogicalPlanBuilder extends DorisParserBaseVisitor<Object> {
}
@Override
public CreateMTMVCommand visitCreateMTMV(CreateMTMVContext ctx) {
public Command visitCreateMTMV(CreateMTMVContext ctx) {
if (ctx.buildMode() == null && ctx.refreshMethod() == null && ctx.refreshTrigger() == null
&& ctx.cols == null && ctx.keys == null
&& ctx.HASH() == null && ctx.RANDOM() == null && ctx.BUCKETS() == null) {
return new UnsupportedCommand();
}
List<String> nameParts = visitMultipartIdentifier(ctx.mvName);
BuildMode buildMode = visitBuildMode(ctx.buildMode());
@ -672,7 +677,7 @@ public class LogicalPlanBuilder extends DorisParserBaseVisitor<Object> {
if (ctx.HASH() != null) {
desc = new DistributionDescriptor(true, ctx.AUTO() != null, bucketNum,
visitIdentifierList(ctx.hashKeys));
} else if (ctx.RANDOM() != null) {
} else {
desc = new DistributionDescriptor(false, ctx.AUTO() != null, bucketNum, null);
}