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 3b7b29b8a68 [fix](mv) Fix test create table like test unstable (#39305)
3b7b29b8a68 is described below

commit 3b7b29b8a68a31c4bf54eb9dda317e7b3e26f65c
Author: seawinde <149132972+seawi...@users.noreply.github.com>
AuthorDate: Mon Aug 19 21:00:50 2024 +0800

    [fix](mv) Fix test create table like test unstable (#39305)
    
    ddl_p0/test_create_table_like_nereids.groovy test result is unstable.
    Should wait util rollup join finished then we can compare the explain
    rollup result.
---
 .../org/apache/doris/regression/suite/Suite.groovy | 33 ++++++++++++++++++++++
 .../ddl_p0/test_create_table_like_nereids.groovy   |  3 ++
 2 files changed, 36 insertions(+)

diff --git 
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
 
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
index d095897fd00..33496257c17 100644
--- 
a/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
+++ 
b/regression-test/framework/src/main/groovy/org/apache/doris/regression/suite/Suite.groovy
@@ -1332,6 +1332,39 @@ class Suite implements GroovyInterceptable {
         }
     }
 
+    def getMVJobState = { tableName, limit  ->
+        def jobStateResult = sql """  SHOW ALTER TABLE ROLLUP WHERE 
TableName='${tableName}' ORDER BY CreateTime DESC limit ${limit}"""
+        if (jobStateResult.size() != limit) {
+            logger.info("show alter table roll is empty" + jobStateResult)
+            return "NOT_READY"
+        }
+        for (int i = 0; i < jobStateResult.size(); i++) {
+            logger.info("getMVJobState is " + jobStateResult[i][8])
+            if (!jobStateResult[i][8].equals("FINISHED")) {
+                return "NOT_READY"
+            }
+        }
+        return "FINISHED";
+    }
+    def waitForRollUpJob =  (tbName, timeoutMillisecond, limit) -> {
+
+        long startTime = System.currentTimeMillis()
+        long timeoutTimestamp = startTime + timeoutMillisecond
+
+        String result
+        // time out or has run exceed 10 minute, then break
+        while (timeoutTimestamp > System.currentTimeMillis() && 
System.currentTimeMillis() - startTime < 600000){
+            result = getMVJobState(tbName, limit)
+            if (result == "FINISHED") {
+                sleep(200)
+                return
+            } else {
+                sleep(200)
+            }
+        }
+        Assert.assertEquals("FINISHED", result)
+    }
+
     String getJobName(String dbName, String mtmvName) {
         String showMTMV = "select JobName from 
mv_infos('database'='${dbName}') where Name = '${mtmvName}'";
            logger.info(showMTMV)
diff --git 
a/regression-test/suites/ddl_p0/test_create_table_like_nereids.groovy 
b/regression-test/suites/ddl_p0/test_create_table_like_nereids.groovy
index 70121e126e3..e6ca0b696ff 100644
--- a/regression-test/suites/ddl_p0/test_create_table_like_nereids.groovy
+++ b/regression-test/suites/ddl_p0/test_create_table_like_nereids.groovy
@@ -46,6 +46,7 @@ suite("test_create_table_like_nereids") {
     // with all rollup
     sql "drop table if exists table_like_with_roll_up"
     sql "CREATE TABLE table_like_with_roll_up LIKE mal_test_create_table_like 
with rollup;"
+    waitForRollUpJob("mal_test_create_table_like", 5000, 2)
     explain {
         sql ("select sum(a) from table_like_with_roll_up group by a")
         contains "ru1"
@@ -58,6 +59,7 @@ suite("test_create_table_like_nereids") {
     // with partial rollup
     sql "drop table if exists table_like_with_partial_roll_up;"
     sql "CREATE TABLE table_like_with_partial_roll_up LIKE 
mal_test_create_table_like with rollup (ru1);"
+    waitForRollUpJob("mal_test_create_table_like", 5000, 2)
     sql "select * from table_like_with_partial_roll_up order by pk, a, b"
     explain {
         sql("select sum(a) from table_like_with_partial_roll_up group by a")
@@ -76,6 +78,7 @@ suite("test_create_table_like_nereids") {
     sql "drop table if exists table_like_with_partial_roll_up_exists"
     sql """CREATE TABLE if not exists table_like_with_partial_roll_up_exists
     LIKE mal_test_create_table_like with rollup (ru1);"""
+    waitForRollUpJob("mal_test_create_table_like", 5000, 2)
 
     sql "drop table if exists test_create_table_like_char_255"
     sql """


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

Reply via email to