From b9912c904516163626a9ee2392b10a8310e9bb22 Mon Sep 17 00:00:00 2001 From: shuke <37901441+shuke987@users.noreply.github.com> Date: Sun, 12 Jul 2026 11:08:58 +0800 Subject: [PATCH] [fix](regression) Stabilize sync MV selection in MTMV test ### What problem does this PR solve? Issue Number: close #xxx Related PR: #37396 Problem Summary: The test verifies that an async MTMV can read a sync rollup and resolve its partition column back to the base table. After the old non-cost-based sync MV control was removed, TRY_IN_RBO could successfully generate the rollup candidate while cost-based planning still selected the base index. Add USE_MV to both the precondition query and the MTMV definition so the test deterministically exercises the intended sync-rollup path. ### Release note None ### Check List (For Author) - Test: Groovy parse and git diff --check - Regression test syntax validation - Behavior changed: No - Does this need documentation: No --- .../suites/rollup_p0/test_create_mv_and_mtmv.groovy | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/regression-test/suites/rollup_p0/test_create_mv_and_mtmv.groovy b/regression-test/suites/rollup_p0/test_create_mv_and_mtmv.groovy index b8c3639fb42841..1efa00f71be4ee 100644 --- a/regression-test/suites/rollup_p0/test_create_mv_and_mtmv.groovy +++ b/regression-test/suites/rollup_p0/test_create_mv_and_mtmv.groovy @@ -52,9 +52,10 @@ suite("test_create_mv_and_mtmv") { dt; """) + // The MTMV must read the sync MV to cover partition-column resolution through the rollup. explain { sql(""" - SELECT dt,advertiser, + SELECT /*+ use_mv(${tableName}.${mvName}) */ dt,advertiser, count(DISTINCT user_id) FROM ${tableName} GROUP BY dt,advertiser""") @@ -68,7 +69,7 @@ suite("test_create_mv_and_mtmv") { DISTRIBUTED BY RANDOM BUCKETS 1 PROPERTIES ('replication_num' = '1') AS - select dt, advertiser, count(distinct user_id) + select /*+ use_mv(${tableName}.${mvName}) */ dt, advertiser, count(distinct user_id) from ${tableName} group by dt, advertiser; """ @@ -109,4 +110,4 @@ AND RefreshMode = '${refreshMode}';""" sql """ DROP TABLE IF EXISTS ${tableName} """ sql """ DROP MATERIALIZED VIEW IF EXISTS ${mtmvName} """ -} \ No newline at end of file +}