From dbb170d58eaa7590b79f8ae06c2dc69417ffc496 Mon Sep 17 00:00:00 2001 From: zhangdong Date: Tue, 11 Mar 2025 18:51:51 +0800 Subject: [PATCH 1/8] 1 --- .../mtmv_p0/test_iot_recycle_mtmv.groovy | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy diff --git a/regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy b/regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy new file mode 100644 index 00000000000000..d7a5b5ced708fb --- /dev/null +++ b/regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy @@ -0,0 +1,59 @@ +// 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_iot_recycle_mtmv","mtmv") { + String suiteName = "test_iot_recycle_mtmv" + String tableName = "${suiteName}_table" + String mvName = "${suiteName}_mv" + String partitionName = "${suiteName}_p1" + + sql """drop table if exists `${tableName}`""" + sql """drop materialized view if exists ${mvName};""" + + sql """ + CREATE TABLE ${tableName} + ( + k2 INT, + k3 INT + ) + PARTITION BY LIST(`k2`) + ( + PARTITION ${partitionName} VALUES IN ('1') + ) + DISTRIBUTED BY HASH(k3) BUCKETS 2 + PROPERTIES ( + "replication_num" = "1" + ); + """ + sql """ + insert into ${tableName} values(1,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}; + """ + + +} From 3cf214543341b0a5f01425c1a670a0cb51e3b6ac Mon Sep 17 00:00:00 2001 From: zhangdong Date: Tue, 11 Mar 2025 19:00:16 +0800 Subject: [PATCH 2/8] 1 --- regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy b/regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy index d7a5b5ced708fb..a6752bc9331a17 100644 --- a/regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy +++ b/regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy @@ -21,7 +21,8 @@ suite("test_iot_recycle_mtmv","mtmv") { String suiteName = "test_iot_recycle_mtmv" String tableName = "${suiteName}_table" String mvName = "${suiteName}_mv" - String partitionName = "${suiteName}_p1" + String partitionName1 = "${suiteName}_p1" + String partitionName1 = "${suiteName}_p1" sql """drop table if exists `${tableName}`""" sql """drop materialized view if exists ${mvName};""" @@ -34,7 +35,8 @@ suite("test_iot_recycle_mtmv","mtmv") { ) PARTITION BY LIST(`k2`) ( - PARTITION ${partitionName} VALUES IN ('1') + PARTITION ${partitionName1} VALUES IN ('1'), + PARTITION ${partitionName2} VALUES IN ('2') ) DISTRIBUTED BY HASH(k3) BUCKETS 2 PROPERTIES ( From 909443e01f2e98b11931e452f1bb372ea44bf4f4 Mon Sep 17 00:00:00 2001 From: zhangdong Date: Tue, 11 Mar 2025 19:01:36 +0800 Subject: [PATCH 3/8] 1 --- regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy b/regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy index a6752bc9331a17..3942160b9ac592 100644 --- a/regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy +++ b/regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy @@ -22,7 +22,7 @@ suite("test_iot_recycle_mtmv","mtmv") { String tableName = "${suiteName}_table" String mvName = "${suiteName}_mv" String partitionName1 = "${suiteName}_p1" - String partitionName1 = "${suiteName}_p1" + String partitionName2 = "${suiteName}_p2" sql """drop table if exists `${tableName}`""" sql """drop materialized view if exists ${mvName};""" From 68ab8d04d301ee2999f692b51ece9f368b549640 Mon Sep 17 00:00:00 2001 From: zhangdong Date: Tue, 11 Mar 2025 19:04:50 +0800 Subject: [PATCH 4/8] 1 --- regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy b/regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy index 3942160b9ac592..a02b553aa8cc4a 100644 --- a/regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy +++ b/regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy @@ -49,6 +49,7 @@ suite("test_iot_recycle_mtmv","mtmv") { sql """ CREATE MATERIALIZED VIEW ${mvName} BUILD DEFERRED REFRESH AUTO ON MANUAL + partition by(`k2`) DISTRIBUTED BY RANDOM BUCKETS 2 PROPERTIES ( 'replication_num' = '1' From 57cf286e09a99d43adcb043c0b37fa9068462eaa Mon Sep 17 00:00:00 2001 From: zhangdong Date: Wed, 12 Mar 2025 10:24:49 +0800 Subject: [PATCH 5/8] 1 --- .../mtmv_p0/test_iot_recycle_mtmv.groovy | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy b/regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy index a02b553aa8cc4a..d7cf5391a10b37 100644 --- a/regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy +++ b/regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy @@ -21,8 +21,6 @@ suite("test_iot_recycle_mtmv","mtmv") { String suiteName = "test_iot_recycle_mtmv" String tableName = "${suiteName}_table" String mvName = "${suiteName}_mv" - String partitionName1 = "${suiteName}_p1" - String partitionName2 = "${suiteName}_p2" sql """drop table if exists `${tableName}`""" sql """drop materialized view if exists ${mvName};""" @@ -30,13 +28,12 @@ suite("test_iot_recycle_mtmv","mtmv") { sql """ CREATE TABLE ${tableName} ( - k2 INT, + k2 BIGINT, k3 INT ) PARTITION BY LIST(`k2`) ( - PARTITION ${partitionName1} VALUES IN ('1'), - PARTITION ${partitionName2} VALUES IN ('2') + PARTITION p1357924687 VALUES IN ('1357924687') ) DISTRIBUTED BY HASH(k3) BUCKETS 2 PROPERTIES ( @@ -44,7 +41,7 @@ suite("test_iot_recycle_mtmv","mtmv") { ); """ sql """ - insert into ${tableName} values(1,1); + insert into ${tableName} values(1357924687,1); """ sql """ CREATE MATERIALIZED VIEW ${mvName} @@ -57,6 +54,12 @@ suite("test_iot_recycle_mtmv","mtmv") { AS SELECT * from ${tableName}; """ - - + def recycleResultBefore = sql """SHOW CATALOG RECYCLE BIN where name ='p_1357924687';""" + assertEquals(0, recycleResultBefore.size()); + sql """ + REFRESH MATERIALIZED VIEW ${mvName} AUTO + """ + waitingMTMVTaskFinishedByMvName(mvName) + def recycleResultAfter = sql """SHOW CATALOG RECYCLE BIN where name ='p_1357924687';""" + assertEquals(0, recycleResultAfter.size()); } From 77c96c98b00a1573b6324c2627acff42077cb0ae Mon Sep 17 00:00:00 2001 From: zhangdong Date: Thu, 27 Mar 2025 20:13:36 +0800 Subject: [PATCH 6/8] 1 --- .../suites/mtmv_p0/test_iot_recycle_mtmv.groovy | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy b/regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy index d7cf5391a10b37..d282d47e8a79da 100644 --- a/regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy +++ b/regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy @@ -21,19 +21,19 @@ suite("test_iot_recycle_mtmv","mtmv") { String suiteName = "test_iot_recycle_mtmv" String tableName = "${suiteName}_table" String mvName = "${suiteName}_mv" + String value = "${suiteName}_value" sql """drop table if exists `${tableName}`""" sql """drop materialized view if exists ${mvName};""" - sql """ CREATE TABLE ${tableName} ( k2 BIGINT, - k3 INT + k3 VARCHAR(100) ) - PARTITION BY LIST(`k2`) + PARTITION BY LIST(`k3`) ( - PARTITION p1357924687 VALUES IN ('1357924687') + PARTITION p1 VALUES IN ('${value}') ) DISTRIBUTED BY HASH(k3) BUCKETS 2 PROPERTIES ( @@ -41,7 +41,7 @@ suite("test_iot_recycle_mtmv","mtmv") { ); """ sql """ - insert into ${tableName} values(1357924687,1); + insert into ${tableName} values(${value},1); """ sql """ CREATE MATERIALIZED VIEW ${mvName} @@ -54,12 +54,15 @@ suite("test_iot_recycle_mtmv","mtmv") { AS SELECT * from ${tableName}; """ - def recycleResultBefore = sql """SHOW CATALOG RECYCLE BIN where name ='p_1357924687';""" + def showPartitionsResult = sql """show partitions from ${mvName}""" + logger.info("showPartitionsResult: " + showPartitionsResult.toString()) + assertTrue(showPartitionsResult.toString().contains("p_${value}")) + def recycleResultBefore = sql """SHOW CATALOG RECYCLE BIN where name ='p_${value}';""" assertEquals(0, recycleResultBefore.size()); sql """ REFRESH MATERIALIZED VIEW ${mvName} AUTO """ waitingMTMVTaskFinishedByMvName(mvName) - def recycleResultAfter = sql """SHOW CATALOG RECYCLE BIN where name ='p_1357924687';""" + def recycleResultAfter = sql """SHOW CATALOG RECYCLE BIN where name ='p_${value}';""" assertEquals(0, recycleResultAfter.size()); } From feef499201fcd6597ce128caa9ee3d74fa7523a5 Mon Sep 17 00:00:00 2001 From: zhangdong Date: Fri, 28 Mar 2025 10:38:25 +0800 Subject: [PATCH 7/8] 1 --- regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy b/regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy index d282d47e8a79da..1485e80a332f31 100644 --- a/regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy +++ b/regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy @@ -41,12 +41,12 @@ suite("test_iot_recycle_mtmv","mtmv") { ); """ sql """ - insert into ${tableName} values(${value},1); + insert into ${tableName} values(1,"${value}"); """ sql """ CREATE MATERIALIZED VIEW ${mvName} BUILD DEFERRED REFRESH AUTO ON MANUAL - partition by(`k2`) + partition by(`k3`) DISTRIBUTED BY RANDOM BUCKETS 2 PROPERTIES ( 'replication_num' = '1' From eb93b43b4b1fbdef8826da170c1fe9ed4b74ef73 Mon Sep 17 00:00:00 2001 From: zhangdong Date: Fri, 28 Mar 2025 10:42:48 +0800 Subject: [PATCH 8/8] 1 --- regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy b/regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy index 1485e80a332f31..a477b87bdc760a 100644 --- a/regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy +++ b/regression-test/suites/mtmv_p0/test_iot_recycle_mtmv.groovy @@ -21,7 +21,7 @@ suite("test_iot_recycle_mtmv","mtmv") { String suiteName = "test_iot_recycle_mtmv" String tableName = "${suiteName}_table" String mvName = "${suiteName}_mv" - String value = "${suiteName}_value" + String value = UUID.randomUUID().toString().replaceAll("-", "") sql """drop table if exists `${tableName}`""" sql """drop materialized view if exists ${mvName};"""