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

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new fc4c2aed649 [enhance](mtmv) Prohibit creating materialized views in 
external cata… (#40420)
fc4c2aed649 is described below

commit fc4c2aed6496162a31e4e2f191153283a80329b9
Author: zhangdong <493738...@qq.com>
AuthorDate: Mon Sep 9 11:16:40 2024 +0800

    [enhance](mtmv) Prohibit creating materialized views in external cata… 
(#40420)
    
    …logs (#39557)
    
    pick: https://github.com/apache/doris/pull/39557
---
 .../nereids/trees/plans/commands/info/CreateMTMVInfo.java      |  4 ++++
 regression-test/suites/mtmv_p0/test_hive_mtmv.groovy           | 10 ++++++++++
 2 files changed, 14 insertions(+)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateMTMVInfo.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateMTMVInfo.java
index d4dc0b95a17..adf0eee8ebe 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateMTMVInfo.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateMTMVInfo.java
@@ -38,6 +38,7 @@ import org.apache.doris.common.FeConstants;
 import org.apache.doris.common.FeNameFormat;
 import org.apache.doris.common.util.DynamicPartitionUtil;
 import org.apache.doris.common.util.PropertyAnalyzer;
+import org.apache.doris.datasource.InternalCatalog;
 import org.apache.doris.mtmv.EnvInfo;
 import org.apache.doris.mtmv.MTMVPartitionInfo;
 import org.apache.doris.mtmv.MTMVPartitionInfo.MTMVPartitionType;
@@ -151,6 +152,9 @@ public class CreateMTMVInfo {
     public void analyze(ConnectContext ctx) throws Exception {
         // analyze table name
         mvName.analyze(ctx);
+        if (!InternalCatalog.INTERNAL_CATALOG_NAME.equals(mvName.getCtl())) {
+            throw new AnalysisException("Only support creating asynchronous 
materialized views in internal catalog");
+        }
         try {
             FeNameFormat.checkTableName(mvName.getTbl());
         } catch (org.apache.doris.common.AnalysisException e) {
diff --git a/regression-test/suites/mtmv_p0/test_hive_mtmv.groovy 
b/regression-test/suites/mtmv_p0/test_hive_mtmv.groovy
index 4ac5ad9e890..7b3abc2300f 100644
--- a/regression-test/suites/mtmv_p0/test_hive_mtmv.groovy
+++ b/regression-test/suites/mtmv_p0/test_hive_mtmv.groovy
@@ -38,6 +38,16 @@ suite("test_hive_mtmv", 
"p0,external,hive,external_docker,external_docker_hive")
             def dbName = "regression_test_mtmv_p0"
             sql """drop materialized view if exists ${mvName};"""
 
+             test {
+                sql """CREATE MATERIALIZED VIEW 
${catalog_name}.`default`.${mvName}
+                           BUILD DEFERRED REFRESH AUTO ON MANUAL
+                           DISTRIBUTED BY RANDOM BUCKETS 2
+                           PROPERTIES ('replication_num' = '1')
+                           AS
+                           SELECT * FROM 
${catalog_name}.`default`.mtmv_base1;"""
+                exception "internal"
+            }
+
             sql """
                 CREATE MATERIALIZED VIEW ${mvName}
                     BUILD DEFERRED REFRESH AUTO ON MANUAL


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to