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 657aba2699d branch-4.1 [fix](regression) Stabilize COUNT pushdown 
assertions in test_pushdown_explain (#69641)
657aba2699d is described below

commit 657aba2699d4cab40318bd1860634e40ef7c9c79
Author: minghong <[email protected]>
AuthorDate: Tue Oct 27 18:59:38 2026 +0800

    branch-4.1 [fix](regression) Stabilize COUNT pushdown assertions in 
test_pushdown_explain (#69641)
    
    ### What problem does this PR solve?
    
    Issue Number: N/A
    
    Problem Summary:
    `test_pushdown_explain` asserts that the plan of
    `select count(1) - count(lo_shipmode) from test_lineorder` contains
    `pushAggOp=COUNT`. `lo_shipmode` is NOT NULL, so this expression is
    always 0.
    `RewriteSimpleAggToConstantRule` can replace both counts with the table
    row
    count from `SimpleAggCacheMgr` and fold the whole expression into a
    constant
    `VUNION` plan before the scan-level COUNT pushdown happens. The row
    count is
    loaded asynchronously, so whether the rule fires depends on whether the
    cache
    has been warmed by the preceding statements. The assertion can therefore
    pass
    or fail depending on statement timing, and the failure can land on the
    second
    or the third count assertion.
    
    Master's `query_p0/explain/test_pushdown_explain.groovy` already
    disables this
    rule before the count assertions. This patch aligns the branch-4.1 test
    with
    master so the case keeps testing the COUNT pushdown path instead of the
    metadata constant rewrite. The query result is unchanged; this is a test
    stabilization, not a planner behavior change.
    
    ### Release note
    
    None
    
    ### Check List (For Author)
    
    - Test: Manual test on a local branch-4.1 (4.1.5) cluster. With
    `SET disable_nereids_rules='REWRITE_SIMPLE_AGG_TO_CONSTANT'`,
    `count(1)`,
      `count(*)` and `count(1) - count(lo_shipmode)` all explain with
    `pushAggOp=COUNT`; without the setting the last query folded to a
    `VUNION`
      constant 0 once the row-count cache was warm.
    - Behavior changed: No
    - Does this need documentation: No
---
 regression-test/suites/nereids_p0/explain/test_pushdown_explain.groovy | 3 +++
 1 file changed, 3 insertions(+)

diff --git 
a/regression-test/suites/nereids_p0/explain/test_pushdown_explain.groovy 
b/regression-test/suites/nereids_p0/explain/test_pushdown_explain.groovy
index 109c868dc67..b4297369e68 100644
--- a/regression-test/suites/nereids_p0/explain/test_pushdown_explain.groovy
+++ b/regression-test/suites/nereids_p0/explain/test_pushdown_explain.groovy
@@ -44,6 +44,9 @@ suite("test_pushdown_explain") {
         "disable_auto_compaction" = "false"
     ); """
     sql """ insert into test_lineorder values(1,2,"asd"); """
+    // Disable REWRITE_SIMPLE_AGG_TO_CONSTANT to prevent the optimizer from 
folding
+    // count() into a constant using metadata row counts, which would skip 
pushAggOp
+    sql "SET disable_nereids_rules='REWRITE_SIMPLE_AGG_TO_CONSTANT'"
     explain {
         sql("select count(1) from test_lineorder;")
         contains "pushAggOp=COUNT"


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

Reply via email to