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

morrysnow pushed a commit to branch branch-3.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-3.1 by this push:
     new e06d48a8f20 branch-3.1: [test](mtmv) Fix regression test not stable 
and fail #52550 (#53173)
e06d48a8f20 is described below

commit e06d48a8f206e4542e624097828a7ecfd6197164
Author: seawinde <[email protected]>
AuthorDate: Mon Jul 14 14:12:27 2025 +0800

    branch-3.1: [test](mtmv) Fix regression test not stable and fail #52550 
(#53173)
    
    picked from #52550
---
 .../mv/availability/grace_period.groovy            |  6 ++-
 .../external_table/part_partition_invalid.groovy   | 52 +++++++++++++++++++++-
 2 files changed, 55 insertions(+), 3 deletions(-)

diff --git 
a/regression-test/suites/nereids_rules_p0/mv/availability/grace_period.groovy 
b/regression-test/suites/nereids_rules_p0/mv/availability/grace_period.groovy
index d4e3a80dbeb..9d46319cba2 100644
--- 
a/regression-test/suites/nereids_rules_p0/mv/availability/grace_period.groovy
+++ 
b/regression-test/suites/nereids_rules_p0/mv/availability/grace_period.groovy
@@ -240,7 +240,7 @@ suite("grace_period") {
             o_orderdate,
             l_partkey,
             l_suppkey""",
-            15,
+            150000,
             "l_shipdate")
 
     sql """
@@ -308,7 +308,9 @@ suite("grace_period") {
         l_suppkey;
         """, mv_partition_allow_staleness_name)
     sql "SET enable_materialized_view_rewrite=true"
-    Thread.sleep(15000);
+
+    sql """ALTER MATERIALIZED VIEW ${mv_partition_allow_staleness_name} 
set('grace_period'='0');"""
+
     // after 10s when partition table, and query use the partition changed, 
should fail
     mv_not_part_in(
         """
diff --git 
a/regression-test/suites/nereids_rules_p0/mv/external_table/part_partition_invalid.groovy
 
b/regression-test/suites/nereids_rules_p0/mv/external_table/part_partition_invalid.groovy
index 47046575aff..ae66a330c3f 100644
--- 
a/regression-test/suites/nereids_rules_p0/mv/external_table/part_partition_invalid.groovy
+++ 
b/regression-test/suites/nereids_rules_p0/mv/external_table/part_partition_invalid.groovy
@@ -151,10 +151,60 @@ suite("part_partition_invalid", 
"p0,external,external_docker") {
     // refresh catalog cache
     sql """ REFRESH CATALOG ${hive_catalog_name} PROPERTIES("invalid_cache" = 
"true"); """
     mv_rewrite_success(query_sql, mv_name)
+    // in 2.1 and 3.0 should not compensate union all, in 3.1 and master 
should compensate union all
     order_qt_after_modify_data_and_refresh_catalog """ ${query_sql}"""
 
+    // query invalid partition data, should not part in mv rewrite
+    mv_not_part_in("""
+            ${query_sql} where o_orderdate = '2023-10-19';
+        """, mv_name)
+    order_qt_after_modify_and_refresh_catalog_19 """ ${query_sql} where 
o_orderdate = '2023-10-19';"""
+
+    // query valid partition data, should hit mv
+    mv_rewrite_success("""
+            ${query_sql} where o_orderdate = '2023-10-18';
+        """, mv_name)
+    order_qt_after_modify_and_refresh_catalog_18 """ ${query_sql} where 
o_orderdate = '2023-10-18';"""
+
+    // refresh manually
+    sql """ REFRESH CATALOG ${hive_catalog_name} PROPERTIES("invalid_cache" = 
"true");  """
+    sql """REFRESH MATERIALIZED VIEW ${mv_name} auto"""
+    waitingMTMVTaskFinished(getJobName(olap_db, mv_name))
+    mv_rewrite_success(query_sql, mv_name)
+    order_qt_after_modify_data_and_refresh_catalog_and_mv """ ${query_sql}"""
+
+    // test after hive add partition
+    sql """insert into ${hive_catalog_name}.${hive_database}.${hive_table} 
values(6, 7, 'ok', 29.5, 'x', 'y', 6, 'ss', '2023-10-20');"""
+
+    // refresh catalog cache
+    sql """ REFRESH CATALOG ${hive_catalog_name} PROPERTIES("invalid_cache" = 
"true"); """
+    mv_rewrite_success(query_sql, mv_name)
+    // in 2.1 and 3.0 should not compensate union all, in 3.1 and master 
should compensate union all
+    order_qt_after_add_data_with_refresh_catalog """ ${query_sql}"""
+
+    // query invalid partition data, should hit mv, because not check now.
+    mv_rewrite_success("""
+            ${query_sql} where o_orderdate = '2023-10-19';
+        """, mv_name)
+
+    order_qt_after_add_and_refresh_catalog_19 """ ${query_sql} where 
o_orderdate = '2023-10-19';"""
+
+    // query valid partition data, mv should not part in mv rewrite
+    mv_not_part_in("""
+            ${query_sql} where o_orderdate = '2023-10-20';
+        """, mv_name)
+    order_qt_after_add_and_refresh_catalog_20 """ ${query_sql} where 
o_orderdate = '2023-10-20';"""
+
+    // refresh manually
+    sql """ REFRESH CATALOG ${hive_catalog_name} PROPERTIES("invalid_cache" = 
"true");  """
+    sql """REFRESH MATERIALIZED VIEW ${mv_name} auto"""
+    waitingMTMVTaskFinished(getJobName(olap_db, mv_name))
+    mv_rewrite_success(query_sql, mv_name)
+    order_qt_after_add_data_and_refresh_catalog_and_mv """ ${query_sql}"""
 
-    sql """drop database if exists ${hive_catalog_name}.${hive_database} 
force"""
+    sql """drop table if exists 
${hive_catalog_name}.${hive_database}.${hive_table}"""
+    sql """drop table if exists ${internal_catalog}.${olap_db}.${olap_table}"""
+    sql """drop database if exists ${hive_catalog_name}.${hive_database}"""
     sql """drop materialized view if exists 
${internal_catalog}.${olap_db}.${mv_name};"""
     sql """drop catalog if exists ${hive_catalog_name}"""
 }


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

Reply via email to