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

morningman 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 496024ffb55 [fix](mtmv) mtmv add case and fix bug (#36019) (#36600)
496024ffb55 is described below

commit 496024ffb553045d0802cd536552856b6aa4c690
Author: zhangdong <493738...@qq.com>
AuthorDate: Tue Jul 2 14:24:53 2024 +0800

    [fix](mtmv) mtmv add case and fix bug (#36019) (#36600)
    
    pick from: #36019
---
 .../org/apache/doris/analysis/AddRollupClause.java |  2 +-
 .../apache/doris/analysis/DropRollupClause.java    |  2 +-
 .../apache/doris/analysis/RollupRenameClause.java  |  2 +-
 .../trees/plans/commands/info/CreateMTMVInfo.java  |  2 +
 .../trees/plans/commands/info/CreateTableInfo.java | 12 ++-
 .../data/mtmv_p0/test_auto_bucket_mtmv.out         |  6 ++
 regression-test/data/mtmv_p0/test_bitmap_mtmv.out  |  6 ++
 .../data/mtmv_p0/test_bloom_filter_mtmv.out        |  6 ++
 .../data/mtmv_p0/test_colocate_with_mtmv.out       |  6 ++
 .../data/mtmv_p0/test_compression_mtmv.out         |  6 ++
 .../data/mtmv_p0/test_create_mv_mtmv.out           | 16 ++++
 .../data/mtmv_p0/test_create_rollup_mtmv.out       | 16 ++++
 .../data/mtmv_p0/test_create_view_mtmv.out         | 15 ++++
 .../data/mtmv_p0/test_inverted_mtmv.out            |  6 ++
 .../data/mtmv_p0/test_light_schema_change_mtmv.out |  6 ++
 regression-test/data/mtmv_p0/test_n_gram_mtmv.out  |  6 ++
 .../mtmv_p0/test_refresh_partition_num_mtmv.out    |  6 ++
 .../data/mtmv_p0/test_schema_version_mtmv.out      |  6 ++
 .../mtmv_p0/test_set_partition_version_mtmv.out    |  6 ++
 .../data/mtmv_p0/test_tablet_type_mtmv.out         |  6 ++
 .../data/mtmv_p0/test_version_info_mtmv.out        |  6 ++
 .../test_alter_distribution_type_mtmv.groovy       | 60 ++++++++++++++
 .../suites/mtmv_p0/test_auto_bucket_mtmv.groovy    | 64 +++++++++++++++
 .../suites/mtmv_p0/test_bitmap_mtmv.groovy         | 79 +++++++++++++++++++
 .../suites/mtmv_p0/test_block_rule_mtmv.groovy     | 70 +++++++++++++++++
 .../suites/mtmv_p0/test_bloom_filter_mtmv.groovy   | 86 ++++++++++++++++++++
 .../suites/mtmv_p0/test_colocate_with_mtmv.groovy  | 77 ++++++++++++++++++
 .../suites/mtmv_p0/test_compression_mtmv.groovy    | 68 ++++++++++++++++
 .../suites/mtmv_p0/test_create_mv_mtmv.groovy      | 90 +++++++++++++++++++++
 .../suites/mtmv_p0/test_create_rollup_mtmv.groovy  | 91 ++++++++++++++++++++++
 .../suites/mtmv_p0/test_create_view_mtmv.groovy    | 72 +++++++++++++++++
 .../suites/mtmv_p0/test_inverted_mtmv.groovy       | 80 +++++++++++++++++++
 .../mtmv_p0/test_light_schema_change_mtmv.groovy   | 64 +++++++++++++++
 .../suites/mtmv_p0/test_limit_op_mtmv.groovy       | 66 +++-------------
 .../suites/mtmv_p0/test_n_gram_mtmv.groovy         | 79 +++++++++++++++++++
 .../mtmv_p0/test_refresh_partition_num_mtmv.groovy | 70 +++++++++++++++++
 .../suites/mtmv_p0/test_schema_version_mtmv.groovy | 64 +++++++++++++++
 .../mtmv_p0/test_sequence_column_mtmv.groovy       | 56 +++++++++++++
 .../mtmv_p0/test_set_partition_version_mtmv.groovy | 73 +++++++++++++++++
 .../suites/mtmv_p0/test_tablet_type_mtmv.groovy    | 64 +++++++++++++++
 .../suites/mtmv_p0/test_version_info_mtmv.groovy   | 64 +++++++++++++++
 41 files changed, 1519 insertions(+), 63 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/AddRollupClause.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/AddRollupClause.java
index 03e4c868fb6..a9df4fedc81 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/AddRollupClause.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/AddRollupClause.java
@@ -91,7 +91,7 @@ public class AddRollupClause extends AlterTableClause {
 
     @Override
     public boolean allowOpMTMV() {
-        return false;
+        return true;
     }
 
     @Override
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/DropRollupClause.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/DropRollupClause.java
index c3d41a4bf75..292dc6c9ada 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/DropRollupClause.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/DropRollupClause.java
@@ -50,7 +50,7 @@ public class DropRollupClause extends AlterTableClause {
 
     @Override
     public boolean allowOpMTMV() {
-        return false;
+        return true;
     }
 
     @Override
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/analysis/RollupRenameClause.java 
b/fe/fe-core/src/main/java/org/apache/doris/analysis/RollupRenameClause.java
index b3af2ec09d8..37544ba6edd 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/RollupRenameClause.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/RollupRenameClause.java
@@ -65,7 +65,7 @@ public class RollupRenameClause extends AlterTableClause {
 
     @Override
     public boolean allowOpMTMV() {
-        return false;
+        return true;
     }
 
     @Override
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 aeb109726e0..ffacc401e27 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
@@ -169,6 +169,8 @@ public class CreateMTMVInfo {
             properties = Maps.newHashMap();
         }
 
+        CreateTableInfo.maybeRewriteByAutoBucket(distribution, properties);
+
         // analyze distribute
         Map<String, ColumnDefinition> columnMap = new 
TreeMap<>(String.CASE_INSENSITIVE_ORDER);
         columns.forEach(c -> columnMap.put(c.getName(), c));
diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateTableInfo.java
 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateTableInfo.java
index edbe078d70d..75531690639 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateTableInfo.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/info/CreateTableInfo.java
@@ -624,9 +624,15 @@ public class CreateTableInfo {
         }
     }
 
-    // if auto bucket auto bucket enable, rewrite distribution bucket num &&
-    // set properties[PropertyAnalyzer.PROPERTIES_AUTO_BUCKET] = "true"
-    private static Map<String, String> maybeRewriteByAutoBucket(
+    /**
+     * if auto bucket auto bucket enable, rewrite distribution bucket num &&
+     * set properties[PropertyAnalyzer.PROPERTIES_AUTO_BUCKET] = "true"
+     *
+     * @param distributionDesc distributionDesc
+     * @param properties properties
+     * @return new properties
+     */
+    public static Map<String, String> maybeRewriteByAutoBucket(
             DistributionDescriptor distributionDesc, Map<String, String> 
properties) {
         if (distributionDesc == null || !distributionDesc.isAutoBucket()) {
             return properties;
diff --git a/regression-test/data/mtmv_p0/test_auto_bucket_mtmv.out 
b/regression-test/data/mtmv_p0/test_auto_bucket_mtmv.out
new file mode 100644
index 00000000000..f4556bbf67a
--- /dev/null
+++ b/regression-test/data/mtmv_p0/test_auto_bucket_mtmv.out
@@ -0,0 +1,6 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !refresh_mv --
+1      1
+2      2
+3      3
+
diff --git a/regression-test/data/mtmv_p0/test_bitmap_mtmv.out 
b/regression-test/data/mtmv_p0/test_bitmap_mtmv.out
new file mode 100644
index 00000000000..f4556bbf67a
--- /dev/null
+++ b/regression-test/data/mtmv_p0/test_bitmap_mtmv.out
@@ -0,0 +1,6 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !refresh_mv --
+1      1
+2      2
+3      3
+
diff --git a/regression-test/data/mtmv_p0/test_bloom_filter_mtmv.out 
b/regression-test/data/mtmv_p0/test_bloom_filter_mtmv.out
new file mode 100644
index 00000000000..f4556bbf67a
--- /dev/null
+++ b/regression-test/data/mtmv_p0/test_bloom_filter_mtmv.out
@@ -0,0 +1,6 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !refresh_mv --
+1      1
+2      2
+3      3
+
diff --git a/regression-test/data/mtmv_p0/test_colocate_with_mtmv.out 
b/regression-test/data/mtmv_p0/test_colocate_with_mtmv.out
new file mode 100644
index 00000000000..f4556bbf67a
--- /dev/null
+++ b/regression-test/data/mtmv_p0/test_colocate_with_mtmv.out
@@ -0,0 +1,6 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !refresh_mv --
+1      1
+2      2
+3      3
+
diff --git a/regression-test/data/mtmv_p0/test_compression_mtmv.out 
b/regression-test/data/mtmv_p0/test_compression_mtmv.out
new file mode 100644
index 00000000000..f4556bbf67a
--- /dev/null
+++ b/regression-test/data/mtmv_p0/test_compression_mtmv.out
@@ -0,0 +1,6 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !refresh_mv --
+1      1
+2      2
+3      3
+
diff --git a/regression-test/data/mtmv_p0/test_create_mv_mtmv.out 
b/regression-test/data/mtmv_p0/test_create_mv_mtmv.out
new file mode 100644
index 00000000000..1ec5caa045e
--- /dev/null
+++ b/regression-test/data/mtmv_p0/test_create_mv_mtmv.out
@@ -0,0 +1,16 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !refresh_mv --
+1      1
+2      2
+3      3
+
+-- !sync_mv --
+1
+2
+3
+
+-- !async_mv --
+1
+2
+3
+
diff --git a/regression-test/data/mtmv_p0/test_create_rollup_mtmv.out 
b/regression-test/data/mtmv_p0/test_create_rollup_mtmv.out
new file mode 100644
index 00000000000..1ec5caa045e
--- /dev/null
+++ b/regression-test/data/mtmv_p0/test_create_rollup_mtmv.out
@@ -0,0 +1,16 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !refresh_mv --
+1      1
+2      2
+3      3
+
+-- !sync_mv --
+1
+2
+3
+
+-- !async_mv --
+1
+2
+3
+
diff --git a/regression-test/data/mtmv_p0/test_create_view_mtmv.out 
b/regression-test/data/mtmv_p0/test_create_view_mtmv.out
new file mode 100644
index 00000000000..d024d2ac0d5
--- /dev/null
+++ b/regression-test/data/mtmv_p0/test_create_view_mtmv.out
@@ -0,0 +1,15 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !init_mv --
+
+-- !init_view --
+
+-- !refresh_mv --
+1      1
+2      2
+3      3
+
+-- !refresh_view --
+1      1
+2      2
+3      3
+
diff --git a/regression-test/data/mtmv_p0/test_inverted_mtmv.out 
b/regression-test/data/mtmv_p0/test_inverted_mtmv.out
new file mode 100644
index 00000000000..f4556bbf67a
--- /dev/null
+++ b/regression-test/data/mtmv_p0/test_inverted_mtmv.out
@@ -0,0 +1,6 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !refresh_mv --
+1      1
+2      2
+3      3
+
diff --git a/regression-test/data/mtmv_p0/test_light_schema_change_mtmv.out 
b/regression-test/data/mtmv_p0/test_light_schema_change_mtmv.out
new file mode 100644
index 00000000000..f4556bbf67a
--- /dev/null
+++ b/regression-test/data/mtmv_p0/test_light_schema_change_mtmv.out
@@ -0,0 +1,6 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !refresh_mv --
+1      1
+2      2
+3      3
+
diff --git a/regression-test/data/mtmv_p0/test_n_gram_mtmv.out 
b/regression-test/data/mtmv_p0/test_n_gram_mtmv.out
new file mode 100644
index 00000000000..f4556bbf67a
--- /dev/null
+++ b/regression-test/data/mtmv_p0/test_n_gram_mtmv.out
@@ -0,0 +1,6 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !refresh_mv --
+1      1
+2      2
+3      3
+
diff --git a/regression-test/data/mtmv_p0/test_refresh_partition_num_mtmv.out 
b/regression-test/data/mtmv_p0/test_refresh_partition_num_mtmv.out
new file mode 100644
index 00000000000..f4556bbf67a
--- /dev/null
+++ b/regression-test/data/mtmv_p0/test_refresh_partition_num_mtmv.out
@@ -0,0 +1,6 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !refresh_mv --
+1      1
+2      2
+3      3
+
diff --git a/regression-test/data/mtmv_p0/test_schema_version_mtmv.out 
b/regression-test/data/mtmv_p0/test_schema_version_mtmv.out
new file mode 100644
index 00000000000..f4556bbf67a
--- /dev/null
+++ b/regression-test/data/mtmv_p0/test_schema_version_mtmv.out
@@ -0,0 +1,6 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !refresh_mv --
+1      1
+2      2
+3      3
+
diff --git a/regression-test/data/mtmv_p0/test_set_partition_version_mtmv.out 
b/regression-test/data/mtmv_p0/test_set_partition_version_mtmv.out
new file mode 100644
index 00000000000..f4556bbf67a
--- /dev/null
+++ b/regression-test/data/mtmv_p0/test_set_partition_version_mtmv.out
@@ -0,0 +1,6 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !refresh_mv --
+1      1
+2      2
+3      3
+
diff --git a/regression-test/data/mtmv_p0/test_tablet_type_mtmv.out 
b/regression-test/data/mtmv_p0/test_tablet_type_mtmv.out
new file mode 100644
index 00000000000..f4556bbf67a
--- /dev/null
+++ b/regression-test/data/mtmv_p0/test_tablet_type_mtmv.out
@@ -0,0 +1,6 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !refresh_mv --
+1      1
+2      2
+3      3
+
diff --git a/regression-test/data/mtmv_p0/test_version_info_mtmv.out 
b/regression-test/data/mtmv_p0/test_version_info_mtmv.out
new file mode 100644
index 00000000000..f4556bbf67a
--- /dev/null
+++ b/regression-test/data/mtmv_p0/test_version_info_mtmv.out
@@ -0,0 +1,6 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !refresh_mv --
+1      1
+2      2
+3      3
+
diff --git 
a/regression-test/suites/mtmv_p0/test_alter_distribution_type_mtmv.groovy 
b/regression-test/suites/mtmv_p0/test_alter_distribution_type_mtmv.groovy
new file mode 100644
index 00000000000..666541613cb
--- /dev/null
+++ b/regression-test/suites/mtmv_p0/test_alter_distribution_type_mtmv.groovy
@@ -0,0 +1,60 @@
+// 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.
+
+import org.junit.Assert;
+
+suite("test_alter_distribution_type_mtmv","mtmv") {
+    String suiteName = "test_light_schema_change_mtmv"
+    String tableName = "${suiteName}_table"
+    String mvName = "${suiteName}_mv"
+
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+
+    sql """
+        CREATE TABLE ${tableName}
+        (
+            k2 INT,
+            k3 varchar(32)
+        )
+        DISTRIBUTED BY HASH(k2) BUCKETS 2
+        PROPERTIES (
+            "replication_num" = "1"
+        );
+        """
+    sql """
+        CREATE MATERIALIZED VIEW ${mvName}
+        BUILD DEFERRED REFRESH AUTO ON MANUAL
+        DISTRIBUTED BY hash(k2) BUCKETS 2
+        PROPERTIES (
+        'replication_num' = '1'
+        )
+        AS
+        SELECT * from ${tableName};
+        """
+
+    sql """
+        ALTER TABLE ${mvName} set ("distribution_type" = "random");
+        """
+
+    def showCreateTableResult = sql """show create table ${mvName}"""
+    logger.info("showCreateTableResult: " + showCreateTableResult.toString())
+    assertTrue(showCreateTableResult.toString().contains('DISTRIBUTED BY 
RANDOM'))
+
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+}
diff --git a/regression-test/suites/mtmv_p0/test_auto_bucket_mtmv.groovy 
b/regression-test/suites/mtmv_p0/test_auto_bucket_mtmv.groovy
new file mode 100644
index 00000000000..faa43f8931d
--- /dev/null
+++ b/regression-test/suites/mtmv_p0/test_auto_bucket_mtmv.groovy
@@ -0,0 +1,64 @@
+// 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.
+
+import org.junit.Assert;
+
+suite("test_auto_bucket_mtmv","mtmv") {
+    String suiteName = "test_auto_bucket_mtmv"
+    String tableName = "${suiteName}_table"
+    String mvName = "${suiteName}_mv"
+
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+
+    sql """
+        CREATE TABLE ${tableName}
+        (
+            k2 INT,
+            k3 varchar(32)
+        )
+        DISTRIBUTED BY HASH(k2) BUCKETS 2
+        PROPERTIES (
+            "replication_num" = "1"
+        );
+        """
+    sql """
+        CREATE MATERIALIZED VIEW ${mvName}
+        BUILD DEFERRED REFRESH AUTO ON MANUAL
+        DISTRIBUTED BY RANDOM BUCKETS AUTO
+        PROPERTIES (
+        'replication_num' = '1',
+        'estimate_partition_size'='2G'
+        )
+        AS
+        SELECT * from ${tableName};
+        """
+
+    sql """
+        insert into ${tableName} values(1,1),(2,2),(3,3);
+        """
+
+     // refresh mv
+     sql """
+        REFRESH MATERIALIZED VIEW ${mvName} complete
+        """
+    waitingMTMVTaskFinishedByMvName(mvName)
+    order_qt_refresh_mv "SELECT * FROM ${mvName}"
+
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+}
diff --git a/regression-test/suites/mtmv_p0/test_bitmap_mtmv.groovy 
b/regression-test/suites/mtmv_p0/test_bitmap_mtmv.groovy
new file mode 100644
index 00000000000..693e6e7e0c9
--- /dev/null
+++ b/regression-test/suites/mtmv_p0/test_bitmap_mtmv.groovy
@@ -0,0 +1,79 @@
+// 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.
+
+import org.junit.Assert;
+
+suite("test_bitmap_mtmv","mtmv") {
+    String suiteName = "test_bitmap_mtmv"
+    String tableName = "${suiteName}_table"
+    String mvName = "${suiteName}_mv"
+
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+
+    sql """
+        CREATE TABLE ${tableName}
+        (
+            k2 INT,
+            k3 varchar(32)
+        )
+        DISTRIBUTED BY HASH(k2) BUCKETS 2
+        PROPERTIES (
+            "replication_num" = "1"
+        );
+        """
+    sql """
+        CREATE MATERIALIZED VIEW ${mvName}
+        BUILD DEFERRED REFRESH AUTO ON MANUAL
+        DISTRIBUTED BY RANDOM BUCKETS 2
+        PROPERTIES (
+        'replication_num' = '1'
+        )
+        AS
+        SELECT * from ${tableName};
+        """
+    // add index
+    sql """
+        CREATE INDEX idx1 ON ${mvName} (k3) USING BITMAP;
+        """
+    assertEquals("FINISHED", getAlterColumnFinalState("${mvName}"))
+    def showIndexResult = sql """show index from ${mvName};"""
+    logger.info("showIndexResult: " + showIndexResult.toString())
+    assertTrue(showIndexResult.toString().contains('idx1'))
+
+    // refresh mv
+    sql """
+        insert into ${tableName} values(1,1),(2,2),(3,3);
+        """
+     sql """
+        REFRESH MATERIALIZED VIEW ${mvName} complete
+        """
+    waitingMTMVTaskFinishedByMvName(mvName)
+    order_qt_refresh_mv "SELECT * FROM ${mvName}"
+
+    // drop index
+    sql """
+        DROP INDEX idx1 ON ${mvName};
+        """
+    assertEquals("FINISHED", getAlterColumnFinalState("${mvName}"))
+    showIndexResult = sql """show index from ${mvName};"""
+    logger.info("showIndexResult: " + showIndexResult.toString())
+    assertFalse(showIndexResult.toString().contains('idx1'))
+
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+}
diff --git a/regression-test/suites/mtmv_p0/test_block_rule_mtmv.groovy 
b/regression-test/suites/mtmv_p0/test_block_rule_mtmv.groovy
new file mode 100644
index 00000000000..d86bc2e9c19
--- /dev/null
+++ b/regression-test/suites/mtmv_p0/test_block_rule_mtmv.groovy
@@ -0,0 +1,70 @@
+// 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.
+
+import org.junit.Assert;
+
+suite("test_block_rule_mtmv","mtmv") {
+    String suiteName = "test_block_rule_mtmv"
+    String tableName = "${suiteName}_table"
+    String mvName = "${suiteName}_mv"
+    String ruleName = "${suiteName}_rule"
+    sql """drop table if exists `${tableName}`"""
+    sql """drop SQL_BLOCK_RULE if exists `${ruleName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+
+    sql """
+        CREATE TABLE ${tableName}
+        (
+            k2 TINYINT,
+            k3 INT not null
+        )
+        DISTRIBUTED BY HASH(k2) BUCKETS 2
+        PROPERTIES (
+            "replication_num" = "1"
+        );
+        """
+    sql """
+        CREATE MATERIALIZED VIEW ${mvName}
+        BUILD DEFERRED REFRESH AUTO ON MANUAL
+        DISTRIBUTED BY RANDOM BUCKETS 2
+        PROPERTIES (
+        'replication_num' = '1'
+        )
+        AS
+        SELECT * from ${tableName};
+        """
+
+    sql"""
+        CREATE SQL_BLOCK_RULE ${ruleName}
+        PROPERTIES(
+          "sql"="select k2 from ${mvName}",
+          "global"="true",
+          "enable"="true"
+        );
+        """
+
+    test {
+          sql """
+               select k2 from ${mvName};
+          """
+          exception "block rule"
+      }
+
+    sql """drop SQL_BLOCK_RULE if exists `${ruleName}`"""
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+}
diff --git a/regression-test/suites/mtmv_p0/test_bloom_filter_mtmv.groovy 
b/regression-test/suites/mtmv_p0/test_bloom_filter_mtmv.groovy
new file mode 100644
index 00000000000..1f307fb6f48
--- /dev/null
+++ b/regression-test/suites/mtmv_p0/test_bloom_filter_mtmv.groovy
@@ -0,0 +1,86 @@
+// 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.
+
+import org.junit.Assert;
+
+suite("test_bloom_filter_mtmv","mtmv") {
+    String suiteName = "test_bloom_filter_mtmv"
+    String tableName = "${suiteName}_table"
+    String mvName = "${suiteName}_mv"
+
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+
+    sql """
+        CREATE TABLE ${tableName}
+        (
+            k2 INT,
+            k3 INT not null
+        )
+        DISTRIBUTED BY HASH(k2) BUCKETS 2
+        PROPERTIES (
+            "replication_num" = "1"
+        );
+        """
+    // create mv with index
+    sql """
+        CREATE MATERIALIZED VIEW ${mvName}
+        BUILD DEFERRED REFRESH AUTO ON MANUAL
+        DISTRIBUTED BY RANDOM BUCKETS 2
+        PROPERTIES (
+        'replication_num' = '1',
+        'bloom_filter_columns'='k2',
+        'bloom_filter_fpp'='0.04'
+        )
+        AS
+        SELECT * from ${tableName};
+        """
+
+    def showCreateTableResult = sql """show create table ${mvName}"""
+    logger.info("showCreateTableResult: " + showCreateTableResult.toString())
+    
assertTrue(showCreateTableResult.toString().contains('bloom_filter_columns" = 
"k2"'))
+
+    sql """
+        insert into ${tableName} values(1,1),(2,2),(3,3);
+        """
+     sql """
+        REFRESH MATERIALIZED VIEW ${mvName} complete
+        """
+    waitingMTMVTaskFinishedByMvName(mvName)
+    order_qt_refresh_mv "SELECT * FROM ${mvName}"
+
+    // alter index
+    sql """
+        ALTER TABLE ${mvName} SET ("bloom_filter_columns" = "k3");
+        """
+    assertEquals("FINISHED", getAlterColumnFinalState("${mvName}"))
+    showCreateTableResult = sql """show create table ${mvName}"""
+    logger.info("showCreateTableResult: " + showCreateTableResult.toString())
+    
assertTrue(showCreateTableResult.toString().contains('bloom_filter_columns" = 
"k3"'))
+
+    // delete index
+    sql """
+        ALTER TABLE ${mvName} SET ("bloom_filter_columns" = "");
+        """
+    assertEquals("FINISHED", getAlterColumnFinalState("${mvName}"))
+    showCreateTableResult = sql """show create table ${mvName}"""
+    logger.info("showCreateTableResult: " + showCreateTableResult.toString())
+    
assertFalse(showCreateTableResult.toString().contains('bloom_filter_columns" = 
"k3"'))
+
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+}
diff --git a/regression-test/suites/mtmv_p0/test_colocate_with_mtmv.groovy 
b/regression-test/suites/mtmv_p0/test_colocate_with_mtmv.groovy
new file mode 100644
index 00000000000..e528ce5aa03
--- /dev/null
+++ b/regression-test/suites/mtmv_p0/test_colocate_with_mtmv.groovy
@@ -0,0 +1,77 @@
+// 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.
+
+import org.junit.Assert;
+
+suite("test_colocate_with_mtmv","mtmv") {
+    String suiteName = "test_colocate_with_mtmv"
+    String groupName = "${suiteName}_group"
+    String tableName = "${suiteName}_table"
+    String mvName = "${suiteName}_mv"
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+
+    sql """
+        CREATE TABLE ${tableName}
+        (
+            k2 TINYINT,
+            k3 INT not null
+        )
+        DISTRIBUTED BY HASH(k2) BUCKETS 2
+        PROPERTIES (
+            "replication_num" = "1",
+            "colocate_with" = "${groupName}"
+        );
+        """
+    test {
+          sql """
+              CREATE MATERIALIZED VIEW ${mvName}
+              BUILD DEFERRED REFRESH AUTO ON MANUAL
+              DISTRIBUTED BY HASH(k2) BUCKETS 3
+              PROPERTIES (
+              'replication_num' = '1',
+              "colocate_with" = "${groupName}"
+              )
+              AS
+              SELECT * from ${tableName};
+          """
+          exception "same bucket"
+        }
+    sql """
+        CREATE MATERIALIZED VIEW ${mvName}
+        BUILD DEFERRED REFRESH AUTO ON MANUAL
+        DISTRIBUTED BY HASH(k2) BUCKETS 2
+        PROPERTIES (
+        'replication_num' = '1',
+        "colocate_with" = "${groupName}"
+        )
+        AS
+        SELECT * from ${tableName};
+        """
+     sql """
+        insert into ${tableName} values(1,1),(2,2),(3,3);
+        """
+     sql """
+        REFRESH MATERIALIZED VIEW ${mvName} AUTO
+        """
+    waitingMTMVTaskFinishedByMvName(mvName)
+
+    order_qt_refresh_mv "SELECT * FROM ${mvName}"
+
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+}
diff --git a/regression-test/suites/mtmv_p0/test_compression_mtmv.groovy 
b/regression-test/suites/mtmv_p0/test_compression_mtmv.groovy
new file mode 100644
index 00000000000..45347908a3e
--- /dev/null
+++ b/regression-test/suites/mtmv_p0/test_compression_mtmv.groovy
@@ -0,0 +1,68 @@
+// 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.
+
+import org.junit.Assert;
+
+suite("test_compression_mtmv","mtmv") {
+    String suiteName = "test_compression_mtmv"
+    String tableName = "${suiteName}_table"
+    String mvName = "${suiteName}_mv"
+
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+
+    sql """
+        CREATE TABLE ${tableName}
+        (
+            k2 INT,
+            k3 varchar(32)
+        )
+        DISTRIBUTED BY HASH(k2) BUCKETS 2
+        PROPERTIES (
+            "replication_num" = "1"
+        );
+        """
+    sql """
+        CREATE MATERIALIZED VIEW ${mvName}
+        BUILD DEFERRED REFRESH AUTO ON MANUAL
+        DISTRIBUTED BY RANDOM BUCKETS 2
+        PROPERTIES (
+        'replication_num' = '1',
+        'compression'='zstd'
+        )
+        AS
+        SELECT * from ${tableName};
+        """
+
+    sql """
+        insert into ${tableName} values(1,1),(2,2),(3,3);
+        """
+
+     // refresh mv
+     sql """
+        REFRESH MATERIALIZED VIEW ${mvName} complete
+        """
+    waitingMTMVTaskFinishedByMvName(mvName)
+    order_qt_refresh_mv "SELECT * FROM ${mvName}"
+
+    def showCreateTableResult = sql """show create table ${mvName}"""
+    logger.info("showCreateTableResult: " + showCreateTableResult.toString())
+    assertTrue(showCreateTableResult.toString().contains('ZSTD'))
+
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+}
diff --git a/regression-test/suites/mtmv_p0/test_create_mv_mtmv.groovy 
b/regression-test/suites/mtmv_p0/test_create_mv_mtmv.groovy
new file mode 100644
index 00000000000..d866d625704
--- /dev/null
+++ b/regression-test/suites/mtmv_p0/test_create_mv_mtmv.groovy
@@ -0,0 +1,90 @@
+// 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.
+
+import org.junit.Assert;
+
+suite("test_create_mv_mtmv","mtmv") {
+    String suiteName = "test_create_mv_mtmv"
+    String tableName = "${suiteName}_table"
+    String mvName = "${suiteName}_mv"
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+
+    sql """
+        CREATE TABLE ${tableName}
+        (
+            k2 TINYINT,
+            k3 INT not null
+        )
+        DISTRIBUTED BY HASH(k2) BUCKETS 2
+        PROPERTIES (
+            "replication_num" = "1"
+        );
+        """
+    sql """
+        CREATE MATERIALIZED VIEW ${mvName}
+        BUILD DEFERRED REFRESH AUTO ON MANUAL
+        DISTRIBUTED BY RANDOM BUCKETS 2
+        PROPERTIES (
+        'replication_num' = '1'
+        )
+        AS
+        SELECT * from ${tableName};
+        """
+
+    sql """
+        CREATE MATERIALIZED VIEW mv_mtmv1  as select k2 from ${mvName};
+        """
+
+    max_try_secs = 60
+    while (max_try_secs--) {
+        def jobStateResult = sql """  SHOW ALTER TABLE MATERIALIZED VIEW WHERE 
TableName='${mvName}' ORDER BY CreateTime DESC LIMIT 1; """
+        String res = jobStateResult[0][8]
+        if (res == "FINISHED" || res == "CANCELLED") {
+            assertEquals("FINISHED", res)
+            sleep(3000)
+            break
+        } else {
+            Thread.sleep(2000)
+            if (max_try_secs < 1) {
+                println "test timeout," + "state:" + res
+                assertEquals("FINISHED",res)
+            }
+        }
+    }
+
+    sql """
+        insert into ${tableName} values(1,1),(2,2),(3,3);
+        """
+     sql """
+        REFRESH MATERIALIZED VIEW ${mvName} complete
+        """
+    waitingMTMVTaskFinishedByMvName(mvName)
+    order_qt_refresh_mv "SELECT * FROM ${mvName}"
+    order_qt_sync_mv "SELECT k2 FROM ${mvName}"
+
+    def explainResult = sql """explain SELECT k2 FROM ${mvName}"""
+    logger.info("explainResult: " + explainResult.toString())
+    assertTrue(explainResult.toString().contains('mv_mtmv1'))
+
+    sql """DROP MATERIALIZED VIEW  mv_mtmv1 ON ${mvName};"""
+
+    order_qt_async_mv "SELECT k2 FROM ${mvName}"
+
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+}
diff --git a/regression-test/suites/mtmv_p0/test_create_rollup_mtmv.groovy 
b/regression-test/suites/mtmv_p0/test_create_rollup_mtmv.groovy
new file mode 100644
index 00000000000..0d47200a819
--- /dev/null
+++ b/regression-test/suites/mtmv_p0/test_create_rollup_mtmv.groovy
@@ -0,0 +1,91 @@
+// 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.
+
+import org.junit.Assert;
+
+suite("test_create_rollup_mtmv","mtmv") {
+    String suiteName = "test_create_rollup_mtmv"
+    String tableName = "${suiteName}_table"
+    String mvName = "${suiteName}_mv"
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+
+    sql """
+        CREATE TABLE ${tableName}
+        (
+            k2 TINYINT,
+            k3 INT not null
+        )
+        DISTRIBUTED BY HASH(k2) BUCKETS 2
+        PROPERTIES (
+            "replication_num" = "1"
+        );
+        """
+    sql """
+        CREATE MATERIALIZED VIEW ${mvName}
+        BUILD DEFERRED REFRESH AUTO ON MANUAL
+        KEY(`k2`)
+        DISTRIBUTED BY RANDOM BUCKETS 2
+        PROPERTIES (
+        'replication_num' = '1'
+        )
+        AS
+        SELECT * from ${tableName};
+        """
+
+    sql """
+        alter table ${mvName} ADD ROLLUP rollup1(k3);
+        """
+
+    max_try_secs = 60
+    while (max_try_secs--) {
+        def jobStateResult = sql """SHOW ALTER TABLE ROLLUP WHERE 
TableName='${mvName}' ORDER BY CreateTime DESC LIMIT 1; """
+        String res = jobStateResult[0][8]
+        if (res == "FINISHED" || res == "CANCELLED") {
+            assertEquals("FINISHED", res)
+            sleep(3000)
+            break
+        } else {
+            Thread.sleep(2000)
+            if (max_try_secs < 1) {
+                println "test timeout," + "state:" + res
+                assertEquals("FINISHED",res)
+            }
+        }
+    }
+
+    sql """
+        insert into ${tableName} values(1,1),(2,2),(3,3);
+        """
+     sql """
+        REFRESH MATERIALIZED VIEW ${mvName} complete
+        """
+    waitingMTMVTaskFinishedByMvName(mvName)
+    order_qt_refresh_mv "SELECT * FROM ${mvName}"
+    order_qt_sync_mv "SELECT k3 FROM ${mvName}"
+
+    def explainResult = sql """explain SELECT k3 FROM ${mvName}"""
+    logger.info("explainResult: " + explainResult.toString())
+    assertTrue(explainResult.toString().contains('rollup1'))
+
+    sql """alter table ${mvName} drop ROLLUP rollup1;"""
+
+    order_qt_async_mv "SELECT k3 FROM ${mvName}"
+
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+}
diff --git a/regression-test/suites/mtmv_p0/test_create_view_mtmv.groovy 
b/regression-test/suites/mtmv_p0/test_create_view_mtmv.groovy
new file mode 100644
index 00000000000..608db77009b
--- /dev/null
+++ b/regression-test/suites/mtmv_p0/test_create_view_mtmv.groovy
@@ -0,0 +1,72 @@
+// 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.
+
+import org.junit.Assert;
+
+suite("test_create_view_mtmv","mtmv") {
+    String suiteName = "test_create_view_mtmv"
+    String tableName = "${suiteName}_table"
+    String mvName = "${suiteName}_mv"
+    String viewName = "${suiteName}_view"
+    sql """drop table if exists `${tableName}`"""
+    sql """drop view if exists `${viewName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+
+    sql """
+        CREATE TABLE ${tableName}
+        (
+            k2 TINYINT,
+            k3 INT not null
+        )
+        DISTRIBUTED BY HASH(k2) BUCKETS 2
+        PROPERTIES (
+            "replication_num" = "1"
+        );
+        """
+    sql """
+        CREATE MATERIALIZED VIEW ${mvName}
+        BUILD DEFERRED REFRESH AUTO ON MANUAL
+        DISTRIBUTED BY RANDOM BUCKETS 2
+        PROPERTIES (
+        'replication_num' = '1'
+        )
+        AS
+        SELECT * from ${tableName};
+        """
+
+    sql"""
+        create view ${viewName} as select * from ${mvName};
+        """
+
+    order_qt_init_mv "SELECT * FROM ${mvName}"
+    order_qt_init_view "SELECT * FROM ${viewName}"
+
+    sql """
+        insert into ${tableName} values(1,1),(2,2),(3,3);
+        """
+     sql """
+        REFRESH MATERIALIZED VIEW ${mvName} AUTO
+        """
+    waitingMTMVTaskFinishedByMvName(mvName)
+
+    order_qt_refresh_mv "SELECT * FROM ${mvName}"
+    order_qt_refresh_view "SELECT * FROM ${viewName}"
+
+    sql """drop view if exists `${viewName}`"""
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+}
diff --git a/regression-test/suites/mtmv_p0/test_inverted_mtmv.groovy 
b/regression-test/suites/mtmv_p0/test_inverted_mtmv.groovy
new file mode 100644
index 00000000000..16c912a8431
--- /dev/null
+++ b/regression-test/suites/mtmv_p0/test_inverted_mtmv.groovy
@@ -0,0 +1,80 @@
+// 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.
+
+import org.junit.Assert;
+
+suite("test_inverted_mtmv","mtmv") {
+    String suiteName = "test_inverted_mtmv"
+    String tableName = "${suiteName}_table"
+    String mvName = "${suiteName}_mv"
+
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+
+    sql """
+        CREATE TABLE ${tableName}
+        (
+            k2 INT,
+            k3 varchar(32)
+        )
+        DISTRIBUTED BY HASH(k2) BUCKETS 2
+        PROPERTIES (
+            "replication_num" = "1"
+        );
+        """
+    sql """
+        CREATE MATERIALIZED VIEW ${mvName}
+        BUILD DEFERRED REFRESH AUTO ON MANUAL
+        DISTRIBUTED BY RANDOM BUCKETS 2
+        PROPERTIES (
+        'replication_num' = '1',
+        'inverted_index_storage_format'='V2'
+        )
+        AS
+        SELECT * from ${tableName};
+        """
+    // add index
+    sql """
+        CREATE INDEX idx1 ON ${mvName} (k3) USING INVERTED;
+        """
+    assertEquals("FINISHED", getAlterColumnFinalState("${mvName}"))
+    def showIndexResult = sql """show index from ${mvName};"""
+    logger.info("showIndexResult: " + showIndexResult.toString())
+    assertTrue(showIndexResult.toString().contains('idx1'))
+
+    // refresh mv
+    sql """
+        insert into ${tableName} values(1,1),(2,2),(3,3);
+        """
+     sql """
+        REFRESH MATERIALIZED VIEW ${mvName} complete
+        """
+    waitingMTMVTaskFinishedByMvName(mvName)
+    order_qt_refresh_mv "SELECT * FROM ${mvName}"
+
+    // drop index
+    sql """
+        DROP INDEX idx1 ON ${mvName};
+        """
+    assertEquals("FINISHED", getAlterColumnFinalState("${mvName}"))
+    showIndexResult = sql """show index from ${mvName};"""
+    logger.info("showIndexResult: " + showIndexResult.toString())
+    assertFalse(showIndexResult.toString().contains('idx1'))
+
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+}
diff --git 
a/regression-test/suites/mtmv_p0/test_light_schema_change_mtmv.groovy 
b/regression-test/suites/mtmv_p0/test_light_schema_change_mtmv.groovy
new file mode 100644
index 00000000000..0e632c00984
--- /dev/null
+++ b/regression-test/suites/mtmv_p0/test_light_schema_change_mtmv.groovy
@@ -0,0 +1,64 @@
+// 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.
+
+import org.junit.Assert;
+
+suite("test_light_schema_change_mtmv","mtmv") {
+    String suiteName = "test_light_schema_change_mtmv"
+    String tableName = "${suiteName}_table"
+    String mvName = "${suiteName}_mv"
+
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+
+    sql """
+        CREATE TABLE ${tableName}
+        (
+            k2 INT,
+            k3 varchar(32)
+        )
+        DISTRIBUTED BY HASH(k2) BUCKETS 2
+        PROPERTIES (
+            "replication_num" = "1"
+        );
+        """
+    sql """
+        CREATE MATERIALIZED VIEW ${mvName}
+        BUILD DEFERRED REFRESH AUTO ON MANUAL
+        DISTRIBUTED BY RANDOM BUCKETS 2
+        PROPERTIES (
+        'replication_num' = '1',
+        'light_schema_change'='true'
+        )
+        AS
+        SELECT * from ${tableName};
+        """
+
+    sql """
+        insert into ${tableName} values(1,1),(2,2),(3,3);
+        """
+
+     // refresh mv
+     sql """
+        REFRESH MATERIALIZED VIEW ${mvName} complete
+        """
+    waitingMTMVTaskFinishedByMvName(mvName)
+    order_qt_refresh_mv "SELECT * FROM ${mvName}"
+
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+}
diff --git a/regression-test/suites/mtmv_p0/test_limit_op_mtmv.groovy 
b/regression-test/suites/mtmv_p0/test_limit_op_mtmv.groovy
index 46c763a04a4..77af3da1231 100644
--- a/regression-test/suites/mtmv_p0/test_limit_op_mtmv.groovy
+++ b/regression-test/suites/mtmv_p0/test_limit_op_mtmv.groovy
@@ -24,25 +24,6 @@ suite("test_limit_op_mtmv") {
     sql """drop table if exists `${tableName}`"""
     sql """drop materialized view if exists ${mvName};"""
 
-    def timeout = 60000
-    def delta_time = 1000
-    def alter_res = "null"
-    def useTime = 0
-    def wait_for_latest_op_on_table_finish = { table_name, OpTimeout ->
-        for(int t = delta_time; t <= OpTimeout; t += delta_time){
-            alter_res = sql """SHOW ALTER TABLE COLUMN WHERE TableName = 
"${table_name}" ORDER BY CreateTime DESC LIMIT 1;"""
-            alter_res = alter_res.toString()
-            if(alter_res.contains("FINISHED")) {
-                sleep(5000) // wait change table state to normal
-                logger.info(table_name + " latest alter job finished, detail: 
" + alter_res)
-                break
-            }
-            useTime = t
-            sleep(delta_time)
-        }
-        assertTrue(useTime <= OpTimeout, "wait_for_latest_op_on_table_finish 
timeout")
-    }
-
     sql """
         CREATE TABLE `${tableName}` (
           `user_id` LARGEINT NOT NULL COMMENT '\"用户id\"',
@@ -210,27 +191,6 @@ suite("test_limit_op_mtmv") {
         log.info(e.getMessage())
     }
 
-
-    // not allow add rollup
-    try {
-        sql """
-            alter table ${mvName} ADD ROLLUP example_rollup_index(num, k3);;
-            """
-        Assert.fail();
-    } catch (Exception e) {
-        log.info(e.getMessage())
-    }
-
-    // not allow drop rollup
-    try {
-        sql """
-            alter table ${mvName} drop ROLLUP example_rollup_index;
-            """
-        Assert.fail();
-    } catch (Exception e) {
-        log.info(e.getMessage())
-    }
-
     // allow modify comment
     try {
         sql """
@@ -241,24 +201,16 @@ suite("test_limit_op_mtmv") {
         Assert.fail();
     }
 
-    // allow add index
-    try {
-        sql """
-            CREATE INDEX index1 ON ${mvName} (num) USING INVERTED;
-            """
-    } catch (Exception e) {
-        log.info(e.getMessage())
-        Assert.fail();
+    // not allow modify engine
+    test {
+        sql """ALTER TABLE ${mvName} MODIFY ENGINE TO odbc PROPERTIES("driver" 
= "MySQL");"""
+        exception "Not allowed"
     }
-    wait_for_latest_op_on_table_finish(mvName, timeout)
-    // allow drop index
-    try {
-        sql """
-            DROP INDEX index1 ON ${mvName};
-            """
-    } catch (Exception e) {
-        log.info(e.getMessage())
-        Assert.fail();
+
+    // not allow enable batch delete
+    test {
+        sql """ALTER TABLE ${mvName} ENABLE FEATURE "BATCH_DELETE";"""
+        exception "only supported in unique tables"
     }
 
     // not allow dynamic_partition
diff --git a/regression-test/suites/mtmv_p0/test_n_gram_mtmv.groovy 
b/regression-test/suites/mtmv_p0/test_n_gram_mtmv.groovy
new file mode 100644
index 00000000000..a089a3ad8e7
--- /dev/null
+++ b/regression-test/suites/mtmv_p0/test_n_gram_mtmv.groovy
@@ -0,0 +1,79 @@
+// 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.
+
+import org.junit.Assert;
+
+suite("test_n_gram_mtmv","mtmv") {
+    String suiteName = "test_n_gram_mtmv"
+    String tableName = "${suiteName}_table"
+    String mvName = "${suiteName}_mv"
+
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+
+    sql """
+        CREATE TABLE ${tableName}
+        (
+            k2 INT,
+            k3 varchar(32)
+        )
+        DISTRIBUTED BY HASH(k2) BUCKETS 2
+        PROPERTIES (
+            "replication_num" = "1"
+        );
+        """
+    sql """
+        CREATE MATERIALIZED VIEW ${mvName}
+        BUILD DEFERRED REFRESH AUTO ON MANUAL
+        DISTRIBUTED BY RANDOM BUCKETS 2
+        PROPERTIES (
+        'replication_num' = '1'
+        )
+        AS
+        SELECT * from ${tableName};
+        """
+    // add index
+    sql """
+        ALTER TABLE ${mvName} add index idx_ngrambf(k3) using NGRAM_BF 
PROPERTIES("gram_size"="2", "bf_size"="512");
+        """
+    assertEquals("FINISHED", getAlterColumnFinalState("${mvName}"))
+    def showIndexResult = sql """show index from ${mvName};"""
+    logger.info("showIndexResult: " + showIndexResult.toString())
+    assertTrue(showIndexResult.toString().contains('idx_ngrambf'))
+
+    // refresh mv
+    sql """
+        insert into ${tableName} values(1,1),(2,2),(3,3);
+        """
+     sql """
+        REFRESH MATERIALIZED VIEW ${mvName} complete
+        """
+    waitingMTMVTaskFinishedByMvName(mvName)
+    order_qt_refresh_mv "SELECT * FROM ${mvName}"
+
+    // drop index
+    sql """
+        ALTER TABLE ${mvName} drop index idx_ngrambf;
+        """
+    assertEquals("FINISHED", getAlterColumnFinalState("${mvName}"))
+    showIndexResult = sql """show index from ${mvName};"""
+    logger.info("showIndexResult: " + showIndexResult.toString())
+    assertFalse(showIndexResult.toString().contains('idx_ngrambf'))
+
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+}
diff --git 
a/regression-test/suites/mtmv_p0/test_refresh_partition_num_mtmv.groovy 
b/regression-test/suites/mtmv_p0/test_refresh_partition_num_mtmv.groovy
new file mode 100644
index 00000000000..d0d90f796ef
--- /dev/null
+++ b/regression-test/suites/mtmv_p0/test_refresh_partition_num_mtmv.groovy
@@ -0,0 +1,70 @@
+// 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.
+
+import org.junit.Assert;
+
+suite("test_refresh_partition_num_mtmv","mtmv") {
+    String suiteName = "test_refresh_partition_num_mtmv"
+    String tableName = "${suiteName}_table"
+    String mvName = "${suiteName}_mv"
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+
+    sql """
+        CREATE TABLE ${tableName}
+        (
+            k2 TINYINT,
+            k3 INT not null
+        )
+        COMMENT "my first table"
+        PARTITION BY LIST(`k3`)
+        (
+            PARTITION `p1` VALUES IN ('1'),
+            PARTITION `p2` VALUES IN ('2'),
+            PARTITION `p3` VALUES IN ('3')
+        )
+        DISTRIBUTED BY HASH(k2) BUCKETS 2
+        PROPERTIES (
+            "replication_num" = "1"
+        );
+        """
+    sql """
+        CREATE MATERIALIZED VIEW ${mvName}
+        BUILD DEFERRED REFRESH AUTO ON MANUAL
+        partition by(`k3`)
+        DISTRIBUTED BY RANDOM BUCKETS 2
+        PROPERTIES (
+        'replication_num' = '1',
+        'refresh_partition_num' = '2'
+        )
+        AS
+        SELECT * from ${tableName};
+        """
+
+    sql """
+        insert into ${tableName} values(1,1),(2,2),(3,3);
+        """
+     sql """
+        REFRESH MATERIALIZED VIEW ${mvName} AUTO
+        """
+    waitingMTMVTaskFinishedByMvName(mvName)
+
+    order_qt_refresh_mv "SELECT * FROM ${mvName}"
+
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+}
diff --git a/regression-test/suites/mtmv_p0/test_schema_version_mtmv.groovy 
b/regression-test/suites/mtmv_p0/test_schema_version_mtmv.groovy
new file mode 100644
index 00000000000..91fb3ba55a3
--- /dev/null
+++ b/regression-test/suites/mtmv_p0/test_schema_version_mtmv.groovy
@@ -0,0 +1,64 @@
+// 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.
+
+import org.junit.Assert;
+
+suite("test_schema_version_mtmv","mtmv") {
+    String suiteName = "test_schema_version_mtmv"
+    String tableName = "${suiteName}_table"
+    String mvName = "${suiteName}_mv"
+
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+
+    sql """
+        CREATE TABLE ${tableName}
+        (
+            k2 INT,
+            k3 varchar(32)
+        )
+        DISTRIBUTED BY HASH(k2) BUCKETS 2
+        PROPERTIES (
+            "replication_num" = "1"
+        );
+        """
+    sql """
+        CREATE MATERIALIZED VIEW ${mvName}
+        BUILD DEFERRED REFRESH AUTO ON MANUAL
+        DISTRIBUTED BY RANDOM BUCKETS 2
+        PROPERTIES (
+        'replication_num' = '1',
+        'schema_version'='3'
+        )
+        AS
+        SELECT * from ${tableName};
+        """
+
+    sql """
+        insert into ${tableName} values(1,1),(2,2),(3,3);
+        """
+
+     // refresh mv
+     sql """
+        REFRESH MATERIALIZED VIEW ${mvName} complete
+        """
+    waitingMTMVTaskFinishedByMvName(mvName)
+    order_qt_refresh_mv "SELECT * FROM ${mvName}"
+
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+}
diff --git a/regression-test/suites/mtmv_p0/test_sequence_column_mtmv.groovy 
b/regression-test/suites/mtmv_p0/test_sequence_column_mtmv.groovy
new file mode 100644
index 00000000000..d9f6a1811ec
--- /dev/null
+++ b/regression-test/suites/mtmv_p0/test_sequence_column_mtmv.groovy
@@ -0,0 +1,56 @@
+// 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.
+
+import org.junit.Assert;
+
+suite("test_sequence_column_mtmv","mtmv") {
+    String suiteName = "test_sequence_column_mtmv"
+    String tableName = "${suiteName}_table"
+    String mvName = "${suiteName}_mv"
+
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+
+    sql """
+        CREATE TABLE ${tableName}
+        (
+            k2 INT,
+            k3 varchar(32)
+        )
+        DISTRIBUTED BY HASH(k2) BUCKETS 2
+        PROPERTIES (
+            "replication_num" = "1"
+        );
+        """
+        test {
+              sql """
+                  CREATE MATERIALIZED VIEW ${mvName}
+                  BUILD DEFERRED REFRESH AUTO ON MANUAL
+                  DISTRIBUTED BY RANDOM BUCKETS 2
+                  PROPERTIES (
+                  'replication_num' = '1',
+                  'function_column.sequence_col'='k2'
+                  )
+                  AS
+                  SELECT * from ${tableName};
+                  """
+              exception "sequence column only support"
+          }
+
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+}
diff --git 
a/regression-test/suites/mtmv_p0/test_set_partition_version_mtmv.groovy 
b/regression-test/suites/mtmv_p0/test_set_partition_version_mtmv.groovy
new file mode 100644
index 00000000000..b496a90168c
--- /dev/null
+++ b/regression-test/suites/mtmv_p0/test_set_partition_version_mtmv.groovy
@@ -0,0 +1,73 @@
+// 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.
+
+import org.junit.Assert;
+
+suite("test_set_partition_version_mtmv","mtmv") {
+    String suiteName = "test_set_partition_version_mtmv"
+    String tableName = "${suiteName}_table"
+    String mvName = "${suiteName}_mv"
+
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+
+    sql """
+        CREATE TABLE ${tableName}
+        (
+            k2 INT,
+            k3 varchar(32)
+        )
+        DISTRIBUTED BY HASH(k2) BUCKETS 2
+        PROPERTIES (
+            "replication_num" = "1"
+        );
+        """
+    sql """
+        CREATE MATERIALIZED VIEW ${mvName}
+        BUILD DEFERRED REFRESH AUTO ON MANUAL
+        DISTRIBUTED BY RANDOM BUCKETS 2
+        PROPERTIES (
+        'replication_num' = '1'
+        )
+        AS
+        SELECT * from ${tableName};
+        """
+
+    def res = sql """ show partitions from ${mvName}; """
+    logger.info("res: " + res.toString())
+    def partitionId = res[0][0].toString()
+
+    // set partition visible version to 20
+    sql """ ADMIN SET TABLE ${mvName} PARTITION VERSION PROPERTIES 
("partition_id" = "${partitionId}", "visible_version" = "20"); """
+    res = sql """ show partitions from ${mvName}; """
+    logger.info("res: " + res.toString())
+    assertEquals(res[0][2].toString(), "20")
+
+    sql """
+        insert into ${tableName} values(1,1),(2,2),(3,3);
+        """
+
+     // refresh mv
+     sql """
+        REFRESH MATERIALIZED VIEW ${mvName} complete
+        """
+    waitingMTMVTaskFinishedByMvName(mvName)
+    order_qt_refresh_mv "SELECT * FROM ${mvName}"
+
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+}
diff --git a/regression-test/suites/mtmv_p0/test_tablet_type_mtmv.groovy 
b/regression-test/suites/mtmv_p0/test_tablet_type_mtmv.groovy
new file mode 100644
index 00000000000..3468c85c1b4
--- /dev/null
+++ b/regression-test/suites/mtmv_p0/test_tablet_type_mtmv.groovy
@@ -0,0 +1,64 @@
+// 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.
+
+import org.junit.Assert;
+
+suite("test_tablet_type_mtmv","mtmv") {
+    String suiteName = "test_tablet_type_mtmv"
+    String tableName = "${suiteName}_table"
+    String mvName = "${suiteName}_mv"
+
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+
+    sql """
+        CREATE TABLE ${tableName}
+        (
+            k2 INT,
+            k3 varchar(32)
+        )
+        DISTRIBUTED BY HASH(k2) BUCKETS 2
+        PROPERTIES (
+            "replication_num" = "1"
+        );
+        """
+    sql """
+        CREATE MATERIALIZED VIEW ${mvName}
+        BUILD DEFERRED REFRESH AUTO ON MANUAL
+        DISTRIBUTED BY RANDOM BUCKETS 2
+        PROPERTIES (
+        'replication_num' = '1',
+        'tablet_type'='memory'
+        )
+        AS
+        SELECT * from ${tableName};
+        """
+
+    sql """
+        insert into ${tableName} values(1,1),(2,2),(3,3);
+        """
+
+     // refresh mv
+     sql """
+        REFRESH MATERIALIZED VIEW ${mvName} complete
+        """
+    waitingMTMVTaskFinishedByMvName(mvName)
+    order_qt_refresh_mv "SELECT * FROM ${mvName}"
+
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+}
diff --git a/regression-test/suites/mtmv_p0/test_version_info_mtmv.groovy 
b/regression-test/suites/mtmv_p0/test_version_info_mtmv.groovy
new file mode 100644
index 00000000000..9de162c32f5
--- /dev/null
+++ b/regression-test/suites/mtmv_p0/test_version_info_mtmv.groovy
@@ -0,0 +1,64 @@
+// 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.
+
+import org.junit.Assert;
+
+suite("test_version_info_mtmv","mtmv") {
+    String suiteName = "test_version_info_mtmv"
+    String tableName = "${suiteName}_table"
+    String mvName = "${suiteName}_mv"
+
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+
+    sql """
+        CREATE TABLE ${tableName}
+        (
+            k2 INT,
+            k3 varchar(32)
+        )
+        DISTRIBUTED BY HASH(k2) BUCKETS 2
+        PROPERTIES (
+            "replication_num" = "1"
+        );
+        """
+    sql """
+        CREATE MATERIALIZED VIEW ${mvName}
+        BUILD DEFERRED REFRESH AUTO ON MANUAL
+        DISTRIBUTED BY RANDOM BUCKETS 2
+        PROPERTIES (
+        'replication_num' = '1',
+        'version_info'='3'
+        )
+        AS
+        SELECT * from ${tableName};
+        """
+
+    sql """
+        insert into ${tableName} values(1,1),(2,2),(3,3);
+        """
+
+     // refresh mv
+     sql """
+        REFRESH MATERIALIZED VIEW ${mvName} complete
+        """
+    waitingMTMVTaskFinishedByMvName(mvName)
+    order_qt_refresh_mv "SELECT * FROM ${mvName}"
+
+    sql """drop table if exists `${tableName}`"""
+    sql """drop materialized view if exists ${mvName};"""
+}


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

Reply via email to