[opt](Nereids) reject group commit insert temporarily (#25359)

group commit insert introduced by PR #22829. since nereids has not
support it, we forbid it temporarily on Nereids until impl it.
This commit is contained in:
morrySnow
2023-10-12 19:20:59 +08:00
committed by GitHub
parent 1a0344df16
commit 0a38546596
3 changed files with 59 additions and 0 deletions

View File

@ -28,6 +28,7 @@ import org.apache.doris.nereids.rules.analysis.CheckAfterRewrite;
import org.apache.doris.nereids.rules.analysis.EliminateGroupByConstant;
import org.apache.doris.nereids.rules.analysis.LogicalSubQueryAliasToLogicalProject;
import org.apache.doris.nereids.rules.analysis.NormalizeAggregate;
import org.apache.doris.nereids.rules.analysis.RejectGroupCommitInsert;
import org.apache.doris.nereids.rules.expression.CheckLegalityAfterRewrite;
import org.apache.doris.nereids.rules.expression.ExpressionNormalization;
import org.apache.doris.nereids.rules.expression.ExpressionOptimization;
@ -267,6 +268,9 @@ public class Rewriter extends AbstractBatchJobExecutor {
topDown(new BuildAggForUnion())
),
// TODO remove it after Nereids support group commit insert
topDown(new RejectGroupCommitInsert()),
// topic("Distinct",
// costBased(custom(RuleType.PUSH_DOWN_DISTINCT_THROUGH_JOIN, PushdownDistinctThroughJoin::new))
// ),

View File

@ -76,6 +76,8 @@ public enum RuleType {
ANALYZE_CTE(RuleTypeClass.REWRITE),
RELATION_AUTHENTICATION(RuleTypeClass.VALIDATION),
REJECT_GROUP_COMMIT_INSERT(RuleTypeClass.REWRITE),
ADJUST_NULLABLE_FOR_PROJECT_SLOT(RuleTypeClass.REWRITE),
ADJUST_NULLABLE_FOR_AGGREGATE_SLOT(RuleTypeClass.REWRITE),
ADJUST_NULLABLE_FOR_HAVING_SLOT(RuleTypeClass.REWRITE),

View File

@ -0,0 +1,53 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.doris.nereids.rules.analysis;
import org.apache.doris.nereids.exceptions.AnalysisException;
import org.apache.doris.nereids.rules.Rule;
import org.apache.doris.nereids.rules.RuleType;
import org.apache.doris.nereids.rules.rewrite.RewriteRuleFactory;
import com.google.common.collect.ImmutableList;
import java.util.List;
/**
* reject group commit insert added by PR <a href="https://github.com/apache/doris/pull/22829/files">#22829</a>
*/
public class RejectGroupCommitInsert implements RewriteRuleFactory {
@Override
public List<Rule> buildRules() {
return ImmutableList.of(
logicalOlapTableSink(logicalOneRowRelation())
.thenApply(ctx -> {
if (ctx.connectContext.getSessionVariable().enableInsertGroupCommit) {
throw new AnalysisException("Nereids do not support group commit now.");
}
return null;
}).toRule(RuleType.REJECT_GROUP_COMMIT_INSERT),
logicalOlapTableSink(logicalUnion().when(u -> u.arity() == 0))
.thenApply(ctx -> {
if (ctx.connectContext.getSessionVariable().enableInsertGroupCommit) {
throw new AnalysisException("Nereids do not support group commit now.");
}
return null;
}).toRule(RuleType.REJECT_GROUP_COMMIT_INSERT)
);
}
}