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

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


The following commit(s) were added to refs/heads/branch-4.1 by this push:
     new fa9e7f57620 branch-4.1:[test](mtmv) Inject stats to external table to 
make external table case stable (#59721) (#61936)
fa9e7f57620 is described below

commit fa9e7f57620f3b40e6df8fdea1883a783199f124
Author: seawinde <[email protected]>
AuthorDate: Tue Mar 31 22:14:52 2026 +0800

    branch-4.1:[test](mtmv) Inject stats to external table to make external 
table case stable (#59721) (#61936)
    
    pr: #59721
    commitId: 51feb02d
---
 .../hudi/hudi_mtmv/test_hudi_olap_rewrite_mtmv.out | 16 +++++
 .../hudi/test_hudi_olap_rewrite_mtmv.groovy        | 83 ++++++++++++++++++++--
 2 files changed, 94 insertions(+), 5 deletions(-)

diff --git 
a/regression-test/data/external_table_p2/hudi/hudi_mtmv/test_hudi_olap_rewrite_mtmv.out
 
b/regression-test/data/external_table_p2/hudi/hudi_mtmv/test_hudi_olap_rewrite_mtmv.out
new file mode 100644
index 00000000000..77597631587
--- /dev/null
+++ 
b/regression-test/data/external_table_p2/hudi/hudi_mtmv/test_hudi_olap_rewrite_mtmv.out
@@ -0,0 +1,16 @@
+-- This file is automatically generated. You should know what you did if you 
want to edit this
+-- !refresh_one_partition --
+a      5
+
+-- !refresh_one_partition_rewrite --
+a      5
+b      5
+
+-- !refresh_auto --
+a      5
+b      5
+
+-- !refresh_all_partition_rewrite --
+a      5
+b      5
+
diff --git 
a/regression-test/suites/external_table_p2/hudi/test_hudi_olap_rewrite_mtmv.groovy
 
b/regression-test/suites/external_table_p2/hudi/test_hudi_olap_rewrite_mtmv.groovy
index 484fe4c60ae..c6acaa9c4ab 100644
--- 
a/regression-test/suites/external_table_p2/hudi/test_hudi_olap_rewrite_mtmv.groovy
+++ 
b/regression-test/suites/external_table_p2/hudi/test_hudi_olap_rewrite_mtmv.groovy
@@ -50,7 +50,7 @@ suite("test_hudi_olap_rewrite_mtmv", "p2,external,hudi") {
     String hudiMinioSecretKey = 
context.config.otherConfigs.get("hudiMinioSecretKey")
 
     sql """set materialized_view_rewrite_enable_contain_external_table=true;"""
-    String mvSql = "SELECT a.id, a.age, a.par, b.user_id, b.num FROM 
${catalogName}.`hudi_mtmv_regression_test`.hudi_table_1 a left join 
${tableName} b on a.id=b.user_id;";
+    String mvSql = "SELECT par, count(*) FROM 
${catalogName}.`hudi_mtmv_regression_test`.hudi_table_1 a left join 
${tableName} b on a.id=b.user_id group by par;";
 
     sql """drop catalog if exists ${catalogName}"""
     sql """
@@ -67,6 +67,82 @@ suite("test_hudi_olap_rewrite_mtmv", "p2,external,hudi") {
 
     sql """analyze table 
${catalogName}.`hudi_mtmv_regression_test`.hudi_table_1 with sync"""
     sql """alter table ${catalogName}.`hudi_mtmv_regression_test`.hudi_table_1 
modify column par set stats ('row_count'='10');"""
+    sql """
+alter table ${catalogName}.hudi_mtmv_regression_test.hudi_table_1
+modify column age set stats (
+  "ndv"="10",
+  "num_nulls"="0",
+  "min_value"="1",
+  "max_value"="10",
+  "row_count"="10"
+);
+"""
+
+    sql """
+alter table ${catalogName}.hudi_mtmv_regression_test.hudi_table_1
+modify column _hoodie_record_key set stats (
+  "ndv"="10",
+  "num_nulls"="0",
+  "min_value"="20250121171615893_0_0",
+  "max_value"="20250121171615893_7_1",
+  "row_count"="10"
+);
+"""
+
+    sql """
+alter table ${catalogName}.hudi_mtmv_regression_test.hudi_table_1
+modify column id set stats (
+  "ndv"="10",
+  "num_nulls"="0",
+  "min_value"="1",
+  "max_value"="10",
+  "row_count"="10"
+);
+"""
+
+    sql """
+alter table ${catalogName}.hudi_mtmv_regression_test.hudi_table_1
+modify column _hoodie_file_name set stats (
+  "ndv"="2",
+  "num_nulls"="0",
+  
"min_value"="58eabd3f-1996-4cb6-83e4-56fd11cb4e7d-0_0-30-108_20250121171615893.parquet",
+  
"max_value"="7f98e9ac-bd11-48fd-ac80-9ca6dc1ddb34-0_1-30-109_20250121171615893.parquet",
+  "row_count"="10"
+);
+"""
+
+    sql """
+alter table ${catalogName}.hudi_mtmv_regression_test.hudi_table_1
+modify column _hoodie_partition_path set stats (
+  "ndv"="2",
+  "num_nulls"="0",
+  "min_value"="par=a",
+  "max_value"="par=b",
+  "row_count"="10"
+);
+"""
+
+    sql """
+alter table ${catalogName}.hudi_mtmv_regression_test.hudi_table_1
+modify column _hoodie_commit_seqno set stats (
+  "ndv"="10",
+  "num_nulls"="0",
+  "min_value"="20250121171615893_0_0",
+  "max_value"="20250121171615893_1_4",
+  "row_count"="10"
+);
+"""
+
+    sql """
+alter table ${catalogName}.hudi_mtmv_regression_test.hudi_table_1
+modify column _hoodie_commit_time set stats (
+  "ndv"="1",
+  "num_nulls"="0",
+  "min_value"="20250121171615893",
+  "max_value"="20250121171615893",
+  "row_count"="10"
+);
+"""
 
     sql """drop materialized view if exists ${mvName};"""
 
@@ -91,15 +167,12 @@ suite("test_hudi_olap_rewrite_mtmv", "p2,external,hudi") {
     waitingMTMVTaskFinishedByMvName(mvName)
     order_qt_refresh_one_partition "SELECT id, age, par, user_id, num FROM 
${mvName} "
 
-    def explainOnePartition = sql """ explain  ${mvSql} """
-    logger.info("explainOnePartition: " + explainOnePartition.toString())
-    assertTrue(explainOnePartition.toString().contains("VUNION"))
     order_qt_refresh_one_partition_rewrite "${mvSql}"
 
     mv_rewrite_success("${mvSql}", "${mvName}")
 
     // select p_b should not rewrite
-    mv_not_part_in("SELECT a.id, a.age, a.par, b.user_id, b.num FROM 
${catalogName}.`hudi_mtmv_regression_test`.hudi_table_1 a left join 
${tableName} b on a.id=b.user_id where a.par='b';", "${mvName}")
+    mv_not_part_in("SELECT par, count(*) FROM 
${catalogName}.`hudi_mtmv_regression_test`.hudi_table_1 a left join 
${tableName} b on a.id=b.user_id where a.par='b' group by par;", "${mvName}")
 
     //refresh auto
     sql """


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

Reply via email to