BiteTheDDDDt commented on code in PR #65853:
URL: https://github.com/apache/doris/pull/65853#discussion_r3635938973


##########
regression-test/suites/query_p0/runtime_filter/rf_partition_pruning.groovy:
##########
@@ -1570,7 +1570,67 @@ suite("rf_partition_pruning", "nonConcurrent") {
         "IN_OR_BLOOM_FILTER", 8, 6)
 
     // ============================================================
-    // Test 53: Switch off enable_runtime_filter_partition_prune -> no pruning
+    // Test 53: Sync MV aliases the base RANGE partition column.
+    // The RF target uses the rollup slot mv_k, while partition metadata is
+    // defined on base column k. FE must serialize the base boundaries with
+    // the MV target slot ID so BE can prune before creating scanners.
+    // ============================================================
+    sql "drop table if exists rf_prune_mv_alias_fact"
+    sql """
+        CREATE TABLE rf_prune_mv_alias_fact (
+            id BIGINT NOT NULL,
+            k INT NOT NULL,
+            v BIGINT NOT NULL
+        ) DUPLICATE KEY(id)
+        PARTITION BY RANGE(k) (
+            PARTITION p0 VALUES [(0),(10)),
+            PARTITION p1 VALUES [(10),(20)),
+            PARTITION p2 VALUES [(20),(30)),
+            PARTITION p3 VALUES [(30),(40))
+        )
+        DISTRIBUTED BY HASH(id) BUCKETS 2
+        PROPERTIES("replication_num" = "1")
+    """
+    sql """
+        INSERT INTO rf_prune_mv_alias_fact
+        SELECT number, number % 40, number * 3
+        FROM numbers("number" = "4000")
+    """
+
+    sql "drop table if exists rf_prune_mv_alias_dim"
+    sql """
+        CREATE TABLE rf_prune_mv_alias_dim (
+            scenario VARCHAR(16) NOT NULL,
+            k INT NOT NULL
+        ) DUPLICATE KEY(scenario, k)
+        DISTRIBUTED BY HASH(k) BUCKETS 2
+        PROPERTIES("replication_num" = "1")
+    """
+    sql """INSERT INTO rf_prune_mv_alias_dim VALUES ('one', 7), ('two', 7), 
('two', 27)"""
+
+    create_sync_mv(context.dbName, "rf_prune_mv_alias_fact", 
"rf_prune_mv_alias_detail", """
+        SELECT k AS mv_k, id AS mv_id, v AS mv_v
+        FROM rf_prune_mv_alias_fact
+    """)
+    sql "set enable_materialized_view_rewrite=true"
+    sql "set pre_materialized_view_rewrite_strategy='TRY_IN_RBO'"
+
+    order_qt_sync_mv_alias_minmax """

Review Comment:
   这个点说得对,结果和聚合后的裁剪计数本身不能排除扫描基表。我已经在同一个同步 MV 查询的结果和 profile 断言之前增加 EXPLAIN 
VERBOSE 断言,要求计划中明确包含 TABLE: 
rf_prune_mv_alias_fact(rf_prune_mv_alias_detail),从而先证明选中的是同步 MV,再校验 4/3 的分区裁剪计数。



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to