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

zhangchen 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 5dc644769a [mtmv](regression-test) add mtmv write data regression test 
(#15546)
5dc644769a is described below

commit 5dc644769a3884b0a31df385fecb44ac6196cbe1
Author: chenlinzhong <490103...@qq.com>
AuthorDate: Tue Jan 10 23:42:42 2023 +0800

    [mtmv](regression-test) add mtmv write data regression test (#15546)
    
    * [regression-test](mtmv) add mtmv write data regression test
    
    * [regression-test](mtmv) add mtmv write data regression test
    
    * [regression-test](mtmv) add mtmv write data regression test
    
    * [regression-test](mtmv) add mtmv write data regression test
    
    * [regression-test](mtmv) add mtmv write data regression test
---
 .../suites/mtmv_p0/test_create_mtmv.groovy         | 86 ++++++++++++++++++++++
 1 file changed, 86 insertions(+)

diff --git a/regression-test/suites/mtmv_p0/test_create_mtmv.groovy 
b/regression-test/suites/mtmv_p0/test_create_mtmv.groovy
new file mode 100644
index 0000000000..a692f9b1ac
--- /dev/null
+++ b/regression-test/suites/mtmv_p0/test_create_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.
+
+suite("test_create_mtmv") {
+    def dbName = "db_mtmv"
+    def tableName="t_user"
+    def tableNamePv="t_user_pv"
+    def mvName="multi_mv"
+    sql """
+        admin set frontend config("enable_mtmv_scheduler_framework"="true");
+        """
+    sql "DROP DATABASE IF EXISTS ${dbName};"
+    sql "create database ${dbName};"
+    sql "use ${dbName};"
+
+    sql """
+        CREATE TABLE IF NOT EXISTS `${tableName}` (
+        event_day DATE,
+        id bigint,
+        username varchar(20)
+        )
+        DISTRIBUTED BY HASH(id) BUCKETS 10 
+        PROPERTIES (
+        "replication_num" = "1"
+        );
+        """
+    sql """
+        insert into ${tableName} 
values("2022-10-26",1,"clz"),("2022-10-28",2,"zhangsang"),("2022-10-29",3,"lisi");
+    """
+    sql """
+        create table ${tableNamePv}(
+        event_day DATE,
+        id bigint,
+        pv bigint
+        )
+        DISTRIBUTED BY HASH(id) BUCKETS 10 
+        PROPERTIES (
+    "replication_num" = "1"
+    );
+    """
+
+    sql """
+        insert into ${tableNamePv} 
values("2022-10-26",1,200),("2022-10-28",2,200),("2022-10-28",3,300);
+    """
+    sql """
+        CREATE MATERIALIZED VIEW  ${mvName}
+        BUILD IMMEDIATE 
+        REFRESH COMPLETE 
+        start with "2022-10-27 19:35:00"
+        next  60 second
+        KEY(username)   
+        DISTRIBUTED BY HASH (username)  buckets 1
+        PROPERTIES ('replication_num' = '1') 
+        AS 
+        select ${tableName}.username, ${tableNamePv}.pv  from ${tableName}, 
${tableNamePv} where ${tableName}.id=${tableNamePv}.id;
+    """
+    int retry=10;
+    boolean is_succ=false;
+    while(retry>0){
+        def result= sql """ select * from   ${mvName}"""
+        if(result.size()!=3){
+            Thread.sleep(1000);
+            retry--;
+        }else{
+            is_succ=true;
+            break;
+        }
+    }
+    assertTrue(is_succ);
+    sql "drop database ${dbName}"
+}
+


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

Reply via email to