From fc4c2aed6496162a31e4e2f191153283a80329b9 Mon Sep 17 00:00:00 2001 From: zhangdong <493738387@qq.com> Date: Mon, 9 Sep 2024 11:16:40 +0800 Subject: [PATCH] =?UTF-8?q?[enhance](mtmv)=20Prohibit=20creating=20materia?= =?UTF-8?q?lized=20views=20in=20external=20cata=E2=80=A6=20(#40420)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …logs (#39557) pick: https://github.com/apache/doris/pull/39557 --- .../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 d4dc0b95a1..adf0eee8eb 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 4ac5ad9e89..7b3abc2300 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