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

yiguolei 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 4967635e541 [test](mtmv) Fix regression test unstable (#40871) (#41082)
4967635e541 is described below

commit 4967635e541cac3f8e56a275b784bf81213b087f
Author: seawinde <[email protected]>
AuthorDate: Fri Sep 20 23:49:23 2024 +0800

    [test](mtmv) Fix regression test unstable (#40871) (#41082)
    
    ## Proposed changes
    
    commitId: da6ac0c5
    pr: https://github.com/apache/doris/pull/40871
---
 .../org/apache/doris/regression/suite/Suite.groovy | 37 +++++++++++++++-------
 .../ddl_p0/test_create_table_like_nereids.groovy   |  7 ++--
 2 files changed, 29 insertions(+), 15 deletions(-)

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 e76de35799d..3afd5e6def1 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
@@ -1264,29 +1264,26 @@ 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) {
+    def getMVJobState = { tableName, rollUpName  ->
+        def jobStateResult = sql """ SHOW ALTER TABLE ROLLUP WHERE 
TableName='${tableName}' and IndexName = '${rollUpName}' ORDER BY CreateTime 
DESC limit 1"""
+        if (jobStateResult == null || jobStateResult.isEmpty()) {
             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"
-            }
+        logger.info("getMVJobState jobStateResult is " + 
jobStateResult.toString())
+        if (!jobStateResult[0][8].equals("FINISHED")) {
+            return "NOT_READY"
         }
         return "FINISHED";
     }
-    def waitForRollUpJob =  (tbName, timeoutMillisecond, limit) -> {
+    def waitForRollUpJob =  (tbName, rollUpName, timeoutMillisecond) -> {
 
         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)
+        while (timeoutTimestamp > System.currentTimeMillis()){
+            result = getMVJobState(tbName, rollUpName)
             if (result == "FINISHED") {
                 sleep(200)
                 return
@@ -1444,6 +1441,22 @@ class Suite implements GroovyInterceptable {
         }
     }
 
+    def mv_rewrite_success_without_check_chosen = { query_sql, mv_name ->
+        explain {
+            sql("${query_sql}")
+            check {result ->
+                def splitResult = result.split("MaterializedViewRewriteFail")
+                splitResult.length == 2 ? splitResult[0].contains(mv_name) : 
false
+            }
+        }
+    }
+
+    def mv_not_part_in = { query_sql, mv_name ->
+        explain {
+            sql("${query_sql}")
+            notContains(mv_name)
+        }
+    }
 
     def check_mv_rewrite_fail = { db, mv_sql, query_sql, mv_name ->
 
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 a153560c0dd..85673a5b326 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
@@ -48,7 +48,8 @@ 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)
+    waitForRollUpJob("mal_test_create_table_like", "r1", 60000)
+    waitForRollUpJob("mal_test_create_table_like", "r2", 60000)
     explain {
         sql ("select sum(a) from table_like_with_roll_up group by a")
         contains "ru1"
@@ -61,7 +62,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)
+    waitForRollUpJob("mal_test_create_table_like", "r1", 60000)
     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")
@@ -81,7 +82,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)
+    waitForRollUpJob("mal_test_create_table_like", "r1", 60000)
 
     sql "drop table if exists test_create_table_like_char_255"
     sql """


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to