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

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


The following commit(s) were added to refs/heads/branch-4.0 by this push:
     new 8b6b871cc93 branch-4.0: [fix](test) fix regression sumRewrite #58232 
(#58235)
8b6b871cc93 is described below

commit 8b6b871cc93728a7a241177f7d0144ba55eba225
Author: yujun <[email protected]>
AuthorDate: Fri Nov 21 23:51:11 2025 +0800

    branch-4.0: [fix](test) fix regression sumRewrite #58232 (#58235)
    
    ### What problem does this PR solve?
    
    cherry-pick: #58232
    
    ### Release note
    
    None
    
    ### Check List (For Author)
    
    - Test <!-- At least one of them must be included. -->
        - [ ] Regression test
        - [ ] Unit Test
        - [ ] Manual test (add detailed scripts or steps below)
        - [ ] No need to test or manual test. Explain why:
    - [ ] This is a refactor/code format and no logic has been changed.
            - [ ] Previous test can cover this change.
            - [ ] No code files have been changed.
            - [ ] Other reason <!-- Add your reason?  -->
    
    - Behavior changed:
        - [ ] No.
        - [ ] Yes. <!-- Explain the behavior change -->
    
    - Does this need documentation?
        - [ ] No.
    - [ ] Yes. <!-- Add document PR link here. eg:
    https://github.com/apache/doris-website/pull/1214 -->
    
    ### Check List (For Reviewer who merge this PR)
    
    - [ ] Confirm the release note
    - [ ] Confirm test cases
    - [ ] Confirm document
    - [ ] Add branch pick label <!-- Add branch pick label that this PR
    should merge into -->
---
 .../data/nereids_rules_p0/sumRewrite.out           | 58 +++++++++++-----------
 1 file changed, 28 insertions(+), 30 deletions(-)

diff --git a/regression-test/data/nereids_rules_p0/sumRewrite.out 
b/regression-test/data/nereids_rules_p0/sumRewrite.out
index 2acd8c0390d..356fad37763 100644
--- a/regression-test/data/nereids_rules_p0/sumRewrite.out
+++ b/regression-test/data/nereids_rules_p0/sumRewrite.out
@@ -3,7 +3,7 @@
 PhysicalResultSink
 --hashAgg[GLOBAL, groupByExpr=(), outputExpr=(sum((cast(id as BIGINT) + 2)) AS 
`sum(id + 2)`)]
 ----hashAgg[LOCAL, groupByExpr=(), outputExpr=(partial_sum((cast(id as BIGINT) 
+ 2)) AS `partial_sum((cast(id as BIGINT) + 2))`)]
-------PhysicalProject[(cast(id as BIGINT) + 2) AS `(cast(id as BIGINT) + 2)`]
+------PhysicalProject[sr.id]
 --------PhysicalOlapScan[sr]
 
 -- !sum_add_const_result --
@@ -13,7 +13,7 @@ PhysicalResultSink
 PhysicalResultSink
 --hashAgg[GLOBAL, groupByExpr=(), outputExpr=(sum((cast(id as BIGINT) + 2)) AS 
`result`)]
 ----hashAgg[LOCAL, groupByExpr=(), outputExpr=(partial_sum((cast(id as BIGINT) 
+ 2)) AS `partial_sum((cast(id as BIGINT) + 2))`)]
-------PhysicalProject[(cast(id as BIGINT) + 2) AS `(cast(id as BIGINT) + 2)`]
+------PhysicalProject[sr.id]
 --------PhysicalOlapScan[sr]
 
 -- !sum_add_const_alias_result --
@@ -23,7 +23,7 @@ PhysicalResultSink
 PhysicalResultSink
 --hashAgg[GLOBAL, groupByExpr=(), outputExpr=(sum((cast(id as BIGINT) + 2)) AS 
`sum(id + 2)`)]
 ----hashAgg[LOCAL, groupByExpr=(), outputExpr=(partial_sum((cast(id as BIGINT) 
+ 2)) AS `partial_sum((cast(id as BIGINT) + 2))`)]
-------PhysicalProject[(cast(id as BIGINT) + 2) AS `(cast(id as BIGINT) + 2)`]
+------PhysicalProject[sr.id]
 --------filter(( not id IS NULL))
 ----------PhysicalOlapScan[sr]
 
@@ -34,7 +34,7 @@ PhysicalResultSink
 PhysicalResultSink
 --hashAgg[GLOBAL, groupByExpr=(sr.not_null_id), outputExpr=(sr.not_null_id, 
sum((cast(id as BIGINT) + 2)) AS `sum(id + 2)`)]
 ----hashAgg[LOCAL, groupByExpr=(sr.not_null_id), 
outputExpr=(partial_sum((cast(id as BIGINT) + 2)) AS `partial_sum((cast(id as 
BIGINT) + 2))`, sr.not_null_id)]
-------PhysicalProject[(cast(id as BIGINT) + 2) AS `(cast(id as BIGINT) + 2)`, 
sr.not_null_id]
+------PhysicalProject[sr.id, sr.not_null_id]
 --------PhysicalOlapScan[sr]
 
 -- !sum_add_const_group_by_result --
@@ -49,7 +49,7 @@ PhysicalResultSink
 --filter((sum(id + 2) > 5))
 ----hashAgg[GLOBAL, groupByExpr=(sr.not_null_id), outputExpr=(sr.not_null_id, 
sum((cast(id as BIGINT) + 2)) AS `sum(id + 2)`)]
 ------hashAgg[LOCAL, groupByExpr=(sr.not_null_id), 
outputExpr=(partial_sum((cast(id as BIGINT) + 2)) AS `partial_sum((cast(id as 
BIGINT) + 2))`, sr.not_null_id)]
---------PhysicalProject[(cast(id as BIGINT) + 2) AS `(cast(id as BIGINT) + 
2)`, sr.not_null_id]
+--------PhysicalProject[sr.id, sr.not_null_id]
 ----------PhysicalOlapScan[sr]
 
 -- !sum_add_const_having_result --
@@ -63,7 +63,7 @@ PhysicalResultSink
 PhysicalResultSink
 --hashAgg[GLOBAL, groupByExpr=(), outputExpr=(sum((cast(id as BIGINT) - 2)) AS 
`sum(id - 2)`)]
 ----hashAgg[LOCAL, groupByExpr=(), outputExpr=(partial_sum((cast(id as BIGINT) 
- 2)) AS `partial_sum((cast(id as BIGINT) - 2))`)]
-------PhysicalProject[(cast(id as BIGINT) - 2) AS `(cast(id as BIGINT) - 2)`]
+------PhysicalProject[sr.id]
 --------PhysicalOlapScan[sr]
 
 -- !sum_sub_const_result --
@@ -73,7 +73,7 @@ PhysicalResultSink
 PhysicalResultSink
 --hashAgg[GLOBAL, groupByExpr=(), outputExpr=(sum((cast(id as BIGINT) - 2)) AS 
`result`)]
 ----hashAgg[LOCAL, groupByExpr=(), outputExpr=(partial_sum((cast(id as BIGINT) 
- 2)) AS `partial_sum((cast(id as BIGINT) - 2))`)]
-------PhysicalProject[(cast(id as BIGINT) - 2) AS `(cast(id as BIGINT) - 2)`]
+------PhysicalProject[sr.id]
 --------PhysicalOlapScan[sr]
 
 -- !sum_sub_const_alias_result --
@@ -83,7 +83,7 @@ PhysicalResultSink
 PhysicalResultSink
 --hashAgg[GLOBAL, groupByExpr=(), outputExpr=(sum((cast(id as BIGINT) - 2)) AS 
`sum(id - 2)`)]
 ----hashAgg[LOCAL, groupByExpr=(), outputExpr=(partial_sum((cast(id as BIGINT) 
- 2)) AS `partial_sum((cast(id as BIGINT) - 2))`)]
-------PhysicalProject[(cast(id as BIGINT) - 2) AS `(cast(id as BIGINT) - 2)`]
+------PhysicalProject[sr.id]
 --------filter(( not id IS NULL))
 ----------PhysicalOlapScan[sr]
 
@@ -94,7 +94,7 @@ PhysicalResultSink
 PhysicalResultSink
 --hashAgg[GLOBAL, groupByExpr=(sr.not_null_id), outputExpr=(sr.not_null_id, 
sum((cast(id as BIGINT) - 2)) AS `sum(id - 2)`)]
 ----hashAgg[LOCAL, groupByExpr=(sr.not_null_id), 
outputExpr=(partial_sum((cast(id as BIGINT) - 2)) AS `partial_sum((cast(id as 
BIGINT) - 2))`, sr.not_null_id)]
-------PhysicalProject[(cast(id as BIGINT) - 2) AS `(cast(id as BIGINT) - 2)`, 
sr.not_null_id]
+------PhysicalProject[sr.id, sr.not_null_id]
 --------PhysicalOlapScan[sr]
 
 -- !sum_sub_const_group_by_result --
@@ -109,7 +109,7 @@ PhysicalResultSink
 --filter((sum(id - 2) > 0))
 ----hashAgg[GLOBAL, groupByExpr=(sr.not_null_id), outputExpr=(sr.not_null_id, 
sum((cast(id as BIGINT) - 2)) AS `sum(id - 2)`)]
 ------hashAgg[LOCAL, groupByExpr=(sr.not_null_id), 
outputExpr=(partial_sum((cast(id as BIGINT) - 2)) AS `partial_sum((cast(id as 
BIGINT) - 2))`, sr.not_null_id)]
---------PhysicalProject[(cast(id as BIGINT) - 2) AS `(cast(id as BIGINT) - 
2)`, sr.not_null_id]
+--------PhysicalProject[sr.id, sr.not_null_id]
 ----------PhysicalOlapScan[sr]
 
 -- !sum_sub_const_having_result --
@@ -122,8 +122,7 @@ PhysicalResultSink
 -- !sum_add_const_empty_table_shape --
 PhysicalResultSink
 --hashAgg[GLOBAL, groupByExpr=(), outputExpr=(sum((cast(id as BIGINT) + 2)) AS 
`sum(id + 2)`)]
-----PhysicalProject[(cast(id as BIGINT) + 2) AS `(cast(id as BIGINT) + 2)`, 
sr.id]
-------PhysicalEmptyRelation
+----PhysicalEmptyRelation
 
 -- !sum_add_const_empty_table_result --
 \N
@@ -137,8 +136,7 @@ PhysicalResultSink
 -- !sum_sub_const_empty_table_shape --
 PhysicalResultSink
 --hashAgg[GLOBAL, groupByExpr=(), outputExpr=(sum((cast(id as BIGINT) - 2)) AS 
`sum(id - 2)`)]
-----PhysicalProject[(cast(id as BIGINT) - 2) AS `(cast(id as BIGINT) - 2)`, 
sr.id]
-------PhysicalEmptyRelation
+----PhysicalEmptyRelation
 
 -- !sum_sub_const_empty_table_result --
 \N
@@ -153,7 +151,7 @@ PhysicalResultSink
 PhysicalResultSink
 --hashAgg[GLOBAL, groupByExpr=(), outputExpr=(sum((cast(f_id as DOUBLE) + 
2.0)) AS `sum(f_id + 2)`)]
 ----hashAgg[LOCAL, groupByExpr=(), outputExpr=(partial_sum((cast(f_id as 
DOUBLE) + 2.0)) AS `partial_sum((cast(f_id as DOUBLE) + 2.0))`)]
-------PhysicalProject[(cast(f_id as DOUBLE) + 2.0) AS `(cast(f_id as DOUBLE) + 
2.0)`]
+------PhysicalProject[sr.f_id]
 --------PhysicalOlapScan[sr]
 
 -- !float_sum_add_const_result --
@@ -163,7 +161,7 @@ PhysicalResultSink
 PhysicalResultSink
 --hashAgg[GLOBAL, groupByExpr=(), outputExpr=(sum((cast(f_id as DOUBLE) + 
2.0)) AS `result`)]
 ----hashAgg[LOCAL, groupByExpr=(), outputExpr=(partial_sum((cast(f_id as 
DOUBLE) + 2.0)) AS `partial_sum((cast(f_id as DOUBLE) + 2.0))`)]
-------PhysicalProject[(cast(f_id as DOUBLE) + 2.0) AS `(cast(f_id as DOUBLE) + 
2.0)`]
+------PhysicalProject[sr.f_id]
 --------PhysicalOlapScan[sr]
 
 -- !float_sum_add_const_alias_result --
@@ -173,7 +171,7 @@ PhysicalResultSink
 PhysicalResultSink
 --hashAgg[GLOBAL, groupByExpr=(), outputExpr=(sum((cast(f_id as DOUBLE) + 
2.0)) AS `sum(f_id + 2)`)]
 ----hashAgg[LOCAL, groupByExpr=(), outputExpr=(partial_sum((cast(f_id as 
DOUBLE) + 2.0)) AS `partial_sum((cast(f_id as DOUBLE) + 2.0))`)]
-------PhysicalProject[(cast(f_id as DOUBLE) + 2.0) AS `(cast(f_id as DOUBLE) + 
2.0)`]
+------PhysicalProject[sr.f_id]
 --------filter(( not f_id IS NULL))
 ----------PhysicalOlapScan[sr]
 
@@ -184,13 +182,13 @@ PhysicalResultSink
 PhysicalResultSink
 --hashAgg[GLOBAL, groupByExpr=(sr.not_null_id), outputExpr=(sr.not_null_id, 
sum((cast(f_id as DOUBLE) + 2.0)) AS `sum(f_id + 2)`)]
 ----hashAgg[LOCAL, groupByExpr=(sr.not_null_id), 
outputExpr=(partial_sum((cast(f_id as DOUBLE) + 2.0)) AS 
`partial_sum((cast(f_id as DOUBLE) + 2.0))`, sr.not_null_id)]
-------PhysicalProject[(cast(f_id as DOUBLE) + 2.0) AS `(cast(f_id as DOUBLE) + 
2.0)`, sr.not_null_id]
+------PhysicalProject[sr.f_id, sr.not_null_id]
 --------PhysicalOlapScan[sr]
 
 -- !float_sum_add_const_group_by_result --
-10     24.0
+10     24
 6      7.300000071525574
-7      11.700000047683716
+7      11.70000004768372
 8      16.09999990463257
 9      20.5
 
@@ -199,13 +197,13 @@ PhysicalResultSink
 --filter((sum(f_id + 2) > 5.0))
 ----hashAgg[GLOBAL, groupByExpr=(sr.not_null_id), outputExpr=(sr.not_null_id, 
sum((cast(f_id as DOUBLE) + 2.0)) AS `sum(f_id + 2)`)]
 ------hashAgg[LOCAL, groupByExpr=(sr.not_null_id), 
outputExpr=(partial_sum((cast(f_id as DOUBLE) + 2.0)) AS 
`partial_sum((cast(f_id as DOUBLE) + 2.0))`, sr.not_null_id)]
---------PhysicalProject[(cast(f_id as DOUBLE) + 2.0) AS `(cast(f_id as DOUBLE) 
+ 2.0)`, sr.not_null_id]
+--------PhysicalProject[sr.f_id, sr.not_null_id]
 ----------PhysicalOlapScan[sr]
 
 -- !float_sum_add_const_having_result --
-10     24.0
+10     24
 6      7.300000071525574
-7      11.700000047683716
+7      11.70000004768372
 8      16.09999990463257
 9      20.5
 
@@ -213,7 +211,7 @@ PhysicalResultSink
 PhysicalResultSink
 --hashAgg[GLOBAL, groupByExpr=(), outputExpr=(sum((cast(f_id as DOUBLE) - 
2.0)) AS `sum(f_id - 2)`)]
 ----hashAgg[LOCAL, groupByExpr=(), outputExpr=(partial_sum((cast(f_id as 
DOUBLE) - 2.0)) AS `partial_sum((cast(f_id as DOUBLE) - 2.0))`)]
-------PhysicalProject[(cast(f_id as DOUBLE) - 2.0) AS `(cast(f_id as DOUBLE) - 
2.0)`]
+------PhysicalProject[sr.f_id]
 --------PhysicalOlapScan[sr]
 
 -- !float_sum_sub_const_result --
@@ -223,7 +221,7 @@ PhysicalResultSink
 PhysicalResultSink
 --hashAgg[GLOBAL, groupByExpr=(), outputExpr=(sum((cast(f_id as DOUBLE) - 
2.0)) AS `result`)]
 ----hashAgg[LOCAL, groupByExpr=(), outputExpr=(partial_sum((cast(f_id as 
DOUBLE) - 2.0)) AS `partial_sum((cast(f_id as DOUBLE) - 2.0))`)]
-------PhysicalProject[(cast(f_id as DOUBLE) - 2.0) AS `(cast(f_id as DOUBLE) - 
2.0)`]
+------PhysicalProject[sr.f_id]
 --------PhysicalOlapScan[sr]
 
 -- !float_sum_sub_const_alias_result --
@@ -233,7 +231,7 @@ PhysicalResultSink
 PhysicalResultSink
 --hashAgg[GLOBAL, groupByExpr=(), outputExpr=(sum((cast(f_id as DOUBLE) - 
2.0)) AS `sum(f_id - 2)`)]
 ----hashAgg[LOCAL, groupByExpr=(), outputExpr=(partial_sum((cast(f_id as 
DOUBLE) - 2.0)) AS `partial_sum((cast(f_id as DOUBLE) - 2.0))`)]
-------PhysicalProject[(cast(f_id as DOUBLE) - 2.0) AS `(cast(f_id as DOUBLE) - 
2.0)`]
+------PhysicalProject[sr.f_id]
 --------filter(( not f_id IS NULL))
 ----------PhysicalOlapScan[sr]
 
@@ -244,11 +242,11 @@ PhysicalResultSink
 PhysicalResultSink
 --hashAgg[GLOBAL, groupByExpr=(sr.not_null_id), outputExpr=(sr.not_null_id, 
sum((cast(f_id as DOUBLE) - 2.0)) AS `sum(f_id - 2)`)]
 ----hashAgg[LOCAL, groupByExpr=(sr.not_null_id), 
outputExpr=(partial_sum((cast(f_id as DOUBLE) - 2.0)) AS 
`partial_sum((cast(f_id as DOUBLE) - 2.0))`, sr.not_null_id)]
-------PhysicalProject[(cast(f_id as DOUBLE) - 2.0) AS `(cast(f_id as DOUBLE) - 
2.0)`, sr.not_null_id]
+------PhysicalProject[sr.f_id, sr.not_null_id]
 --------PhysicalOlapScan[sr]
 
 -- !float_sum_sub_const_group_by_result --
-10     16.0
+10     16
 6      -0.6999999284744263
 7      3.700000047683716
 8      8.099999904632568
@@ -259,11 +257,11 @@ PhysicalResultSink
 --filter((sum(f_id - 2) > 0.0))
 ----hashAgg[GLOBAL, groupByExpr=(sr.not_null_id), outputExpr=(sr.not_null_id, 
sum((cast(f_id as DOUBLE) - 2.0)) AS `sum(f_id - 2)`)]
 ------hashAgg[LOCAL, groupByExpr=(sr.not_null_id), 
outputExpr=(partial_sum((cast(f_id as DOUBLE) - 2.0)) AS 
`partial_sum((cast(f_id as DOUBLE) - 2.0))`, sr.not_null_id)]
---------PhysicalProject[(cast(f_id as DOUBLE) - 2.0) AS `(cast(f_id as DOUBLE) 
- 2.0)`, sr.not_null_id]
+--------PhysicalProject[sr.f_id, sr.not_null_id]
 ----------PhysicalOlapScan[sr]
 
 -- !float_sum_sub_const_having_result --
-10     16.0
+10     16
 7      3.700000047683716
 8      8.099999904632568
 9      12.5


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

Reply via email to