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

commit dc4753253dad580cbe1a90a5946a4e5d4c1bed10
Author: zhangdong <[email protected]>
AuthorDate: Wed Apr 24 15:20:09 2024 +0800

    [fix](mtmv) Mv check name (#34016)
---
 .../nereids/trees/plans/commands/info/CreateMTMVInfo.java |  5 +++++
 regression-test/suites/mtmv_p0/test_build_mtmv.groovy     | 15 +++++++++++++++
 2 files changed, 20 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 ce02dff2470..b56265b999a 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
@@ -140,6 +140,11 @@ public class CreateMTMVInfo {
     public void analyze(ConnectContext ctx) {
         // analyze table name
         mvName.analyze(ctx);
+        try {
+            FeNameFormat.checkTableName(mvName.getTbl());
+        } catch (org.apache.doris.common.AnalysisException e) {
+            throw new AnalysisException(e.getMessage(), e);
+        }
         if (!Env.getCurrentEnv().getAccessManager().checkTblPriv(ctx, 
mvName.getCtl(), mvName.getDb(),
                 mvName.getTbl(), PrivPredicate.CREATE)) {
             String message = 
ErrorCode.ERR_TABLEACCESS_DENIED_ERROR.formatErrorMsg("CREATE",
diff --git a/regression-test/suites/mtmv_p0/test_build_mtmv.groovy 
b/regression-test/suites/mtmv_p0/test_build_mtmv.groovy
index ed5f11aeb1a..c431c3a7885 100644
--- a/regression-test/suites/mtmv_p0/test_build_mtmv.groovy
+++ b/regression-test/suites/mtmv_p0/test_build_mtmv.groovy
@@ -141,6 +141,21 @@ suite("test_build_mtmv") {
         DROP MATERIALIZED VIEW ${mvName}
     """
 
+    // check mvName
+    try {
+        sql """
+            CREATE MATERIALIZED VIEW ` `
+            BUILD DEFERRED REFRESH COMPLETE ON MANUAL
+            DISTRIBUTED BY RANDOM BUCKETS 2
+            PROPERTIES ('replication_num' = '1')
+            AS
+            SELECT * from ${tableName};
+        """
+        Assert.fail();
+    } catch (Exception e) {
+        log.info(e.getMessage())
+    }
+
     // use default value
     sql """
             CREATE MATERIALIZED VIEW ${mvName}


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

Reply via email to