Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 28 additions & 30 deletions regression-test/data/nereids_rules_p0/sumRewrite.out
Original file line number Diff line number Diff line change
Expand Up @@ -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 --
Expand All @@ -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 --
Expand All @@ -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]

Expand All @@ -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 --
Expand All @@ -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 --
Expand All @@ -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 --
Expand All @@ -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 --
Expand All @@ -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]

Expand All @@ -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 --
Expand All @@ -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 --
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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 --
Expand All @@ -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 --
Expand All @@ -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]

Expand All @@ -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

Expand All @@ -199,21 +197,21 @@ 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

-- !float_sum_sub_const_shape --
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 --
Expand All @@ -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 --
Expand All @@ -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]

Expand All @@ -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
Expand All @@ -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
Expand Down
Loading