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

morrysnow 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 da6ac0c5f47 [test](mtmv) Fix regression test unstable (#40871)
da6ac0c5f47 is described below

commit da6ac0c5f472b707b1dba30f71d5a6d85b158545
Author: seawinde <149132972+seawi...@users.noreply.github.com>
AuthorDate: Fri Sep 20 18:41:22 2024 +0800

    [test](mtmv) Fix regression test unstable (#40871)
    
    1. Optimized `waitForRollUpJob` method in `Suite.groovy` to make sure
    roll up is build succesfully before rewirte.
    2. Modify expect rewritten result in` agg_sync_mv.groovy`
---
 .../org/apache/doris/regression/suite/Suite.groovy  | 21 +++++++++------------
 .../ddl_p0/test_create_table_like_nereids.groovy    |  7 ++++---
 .../suites/nereids_p0/hint/test_use_mv.groovy       |  4 ++--
 .../mv/aggregate/agg_sync_mv.groovy                 |  4 +++-
 4 files changed, 18 insertions(+), 18 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 ad14e23f94a..73b2cf9b5bc 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
@@ -1397,29 +1397,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
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 e6ca0b696ff..a371f5ac051 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,7 +46,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"
@@ -59,7 +60,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")
@@ -78,7 +79,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 """
diff --git a/regression-test/suites/nereids_p0/hint/test_use_mv.groovy 
b/regression-test/suites/nereids_p0/hint/test_use_mv.groovy
index c63705b9059..e8bf38a9066 100644
--- a/regression-test/suites/nereids_p0/hint/test_use_mv.groovy
+++ b/regression-test/suites/nereids_p0/hint/test_use_mv.groovy
@@ -53,9 +53,9 @@ suite("test_use_mv") {
                         );
     """
     sql """ alter table t1 add rollup r1(k2, k1); """
-    waitForRollUpJob("t1", 5000, 1)
+    waitForRollUpJob("t1", "r1", 15000)
     sql """ alter table t1 add rollup r2(k2); """
-    waitForRollUpJob("t1", 5000, 1)
+    waitForRollUpJob("t1", "r2", 15000)
     createMV("create materialized view k1_k2_sumk3 as select k1, k2, sum(v1) 
from t1 group by k1, k2;")
     explain {
         sql """select /*+ no_use_mv */ k1 from t1;"""
diff --git 
a/regression-test/suites/nereids_syntax_p0/mv/aggregate/agg_sync_mv.groovy 
b/regression-test/suites/nereids_syntax_p0/mv/aggregate/agg_sync_mv.groovy
index bb1b71e372f..e63037ced79 100644
--- a/regression-test/suites/nereids_syntax_p0/mv/aggregate/agg_sync_mv.groovy
+++ b/regression-test/suites/nereids_syntax_p0/mv/aggregate/agg_sync_mv.groovy
@@ -453,7 +453,9 @@ suite("agg_sync_mv") {
     createMV("""create materialized view mv_sync48 as select id, var_pop(kint) 
from agg_mv_test group by id order by id;""")
     explain {
         sql("select id, var_pop(kint) from agg_mv_test group by id order by 
id;")
-        contains "(mv_sync47)"
+        check { result ->
+            result.contains("(mv_sync47)") || result.contains("(mv_sync48)")
+        }
     }
     qt_select_var_pop_mv """select id, var_pop(kint) from agg_mv_test group by 
id order by id;"""
 


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

Reply via email to