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

dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new cae8161dd8 [test](lazy open) add lazy open test (#19896)
cae8161dd8 is described below

commit cae8161dd8fac5c84dee47e36315d4d511eab699
Author: HHoflittlefish777 <77738092+hhoflittlefish...@users.noreply.github.com>
AuthorDate: Tue May 23 14:03:15 2023 +0800

    [test](lazy open) add lazy open test (#19896)
---
 .../test_materialized_view_lazy_open.groovy        | 117 +++++++++++++++++++++
 1 file changed, 117 insertions(+)

diff --git 
a/regression-test/suites/rollup_p0/test_materialized_view_lazy_open.groovy 
b/regression-test/suites/rollup_p0/test_materialized_view_lazy_open.groovy
new file mode 100644
index 0000000000..064acdd9d4
--- /dev/null
+++ b/regression-test/suites/rollup_p0/test_materialized_view_lazy_open.groovy
@@ -0,0 +1,117 @@
+// 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.
+
+suite("test_materialized_view_lazy_open", "rollup") {
+
+    // because nereids cannot support rollup correctly forbid it temporary
+    sql """set enable_nereids_planner=false"""
+
+    def tbName1 = "test_materialized_view_lazy_open"
+    def tbName2 = "test_materialized_view_lazy_open_dynamic_partition"
+
+    def getJobState = { tableName ->
+        def jobStateResult = sql """  SHOW ALTER TABLE MATERIALIZED VIEW WHERE 
TableName='${tableName}' ORDER BY CreateTime DESC LIMIT 1; """
+        return jobStateResult[0][8]
+    }
+
+    sql "DROP TABLE IF EXISTS ${tbName1}"
+    sql """
+            CREATE TABLE IF NOT EXISTS ${tbName1}(
+                k1 DATE,
+                k2 DECIMAL(10, 2),
+                k3 CHAR(10),
+                k4 INT NOT NULL
+            )
+            DUPLICATE KEY(k1, k2)
+            PARTITION BY RANGE(k1)
+            (
+               PARTITION p1 VALUES LESS THAN ("2000-01-01"),
+               PARTITION p2 VALUES LESS THAN ("2010-01-01"),
+               PARTITION p3 VALUES LESS THAN ("2020-01-01")
+            )
+            DISTRIBUTED BY HASH(k1) BUCKETS 32 
+            properties("replication_num" = "1");
+        """
+
+    sql "DROP TABLE IF EXISTS ${tbName2}"
+    sql """
+            CREATE TABLE IF NOT EXISTS ${tbName2}(
+                k1 DATE,
+                k2 DECIMAL(10, 2),
+                k3 CHAR(10),
+                k4 INT NOT NULL
+            )
+            PARTITION BY RANGE(k1)
+            (
+               PARTITION p1 VALUES LESS THAN ("2000-01-01"),
+               PARTITION p2 VALUES LESS THAN ("2010-01-01"),
+               PARTITION p3 VALUES LESS THAN ("2020-01-01")
+            )
+            DISTRIBUTED BY HASH(k1)
+            PROPERTIES
+            (
+                "dynamic_partition.enable" = "true",
+                "dynamic_partition.time_unit" = "DAY",
+                "dynamic_partition.start" = "-2147483648",
+                "dynamic_partition.end" = "3",
+                "dynamic_partition.prefix" = "p",
+                "dynamic_partition.buckets" = "32",
+                "replication_num"="1"
+            );
+        """
+    
+    sql "CREATE materialized VIEW test_lazy_open AS SELECT k1 FROM ${tbName1} 
GROUP BY k1;"
+    int max_try_secs = 60
+    while (max_try_secs--) {
+        String res = getJobState(tbName1)
+        if (res == "FINISHED") {
+            sleep(3000)
+            break
+        } else {
+            Thread.sleep(2000)
+            if (max_try_secs < 1) {
+                println "test timeout," + "state:" + res
+                assertEquals("FINISHED",res)
+            }
+        }
+    }
+
+    sql "CREATE materialized VIEW test_lazy_open_dynamic_partition AS SELECT 
k1 FROM ${tbName2} GROUP BY k1;"
+    max_try_secs = 60
+    while (max_try_secs--) {
+        String res = getJobState(tbName2)
+        if (res == "FINISHED") {
+            sleep(3000)
+            break
+        } else {
+            Thread.sleep(2000)
+            if (max_try_secs < 1) {
+                println "test timeout," + "state:" + res
+                assertEquals("FINISHED",res)
+            }
+        }
+    }
+
+    sql "insert into ${tbName1} values('2000-05-20', 1.5, 'test', 1);"
+    sql "insert into ${tbName1} values('2010-05-20', 1.5, 'test', 1);"
+    sql "insert into ${tbName2} values('2000-05-20', 1.5, 'test', 1);"
+    sql "insert into ${tbName2} values('2010-05-20', 1.5, 'test', 1);"
+
+    sql "DROP TABLE ${tbName1} FORCE;"
+    sql "DROP TABLE ${tbName2} FORCE;"
+
+}
\ No newline at end of file


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

Reply via email to