This is an automated email from the ASF dual-hosted git repository.

morrysnow pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 0a385465960 [opt](Nereids) reject group commit insert temporarily 
(#25359)
0a385465960 is described below

commit 0a385465960c86508af5cf445154a2b4e3505f38
Author: morrySnow <[email protected]>
AuthorDate: Thu Oct 12 19:20:59 2023 +0800

    [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.
---
 .../doris/nereids/jobs/executor/Rewriter.java      |  4 ++
 .../org/apache/doris/nereids/rules/RuleType.java   |  2 +
 .../rules/analysis/RejectGroupCommitInsert.java    | 53 ++++++++++++++++++++++
 3 files changed, 59 insertions(+)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Rewriter.java 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Rewriter.java
index fcdb3573836..e1db7bfb8d0 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Rewriter.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/jobs/executor/Rewriter.java
@@ -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))
             // ),
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/RuleType.java 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/RuleType.java
index 83196453190..eeec3d30fb9 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/RuleType.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/RuleType.java
@@ -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),
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/RejectGroupCommitInsert.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/RejectGroupCommitInsert.java
new file mode 100644
index 00000000000..19c9706e03d
--- /dev/null
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/RejectGroupCommitInsert.java
@@ -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)
+        );
+    }
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to