From 5aa17ad1aed2320eb756556b0c4982b3c3f52998 Mon Sep 17 00:00:00 2001 From: feiniaofeiafei Date: Thu, 12 Dec 2024 12:02:38 +0800 Subject: [PATCH] fix regression --- .../distinct_split/disitinct_split.out | 49 +++++++++++++++++++ .../distinct_split/disitinct_split.groovy | 19 ++++++- .../aggregate_without_roll_up.groovy | 4 +- .../mv/dimension/dimension_2_3.groovy | 2 +- .../mv/dimension/dimension_2_4.groovy | 2 +- 5 files changed, 71 insertions(+), 5 deletions(-) diff --git a/regression-test/data/nereids_rules_p0/distinct_split/disitinct_split.out b/regression-test/data/nereids_rules_p0/distinct_split/disitinct_split.out index 53e344b40d45113..cd10c541cc24c79 100644 --- a/regression-test/data/nereids_rules_p0/distinct_split/disitinct_split.out +++ b/regression-test/data/nereids_rules_p0/distinct_split/disitinct_split.out @@ -254,6 +254,55 @@ -- !010_count_other_func_has_upper -- 1 4 25 2 +-- !cte_producer -- +2 1 + +-- !cte_consumer -- +2 1 2 1 + +-- !cte_multi_producer -- +2 1 3 2 3 1 + +-- !multi_cte_nest -- +2 1 3 2 3 1 2 1 3 2 3 1 + +-- !multi_cte_nest2 -- +2 1 3 2 3 1 2 1 3 2 3 1 2 1 3 2 3 1 2 1 3 2 3 1 2 1 3 2 3 1 2 1 3 2 3 1 + +-- !cte_consumer_count_multi_column_with_group_by -- +1 1 1 1 +1 1 2 2 +1 1 2 2 +2 2 1 1 +2 2 1 1 +2 2 2 2 +2 2 2 2 +2 2 2 2 +2 2 2 2 + +-- !cte_consumer_count_multi_column_without_group_by -- +3 2 3 2 + +-- !cte_multi_producer_multi_column -- +1 2 1 2 3 1 +1 2 3 2 3 1 +2 3 1 2 3 1 +2 3 3 2 3 1 + +-- !cte_multi_nested -- +1 2 1 2 3 1 3 2 1 1 +1 2 1 2 3 1 3 2 3 2 +1 2 1 2 3 1 3 2 3 2 +1 2 3 2 3 1 3 2 1 1 +1 2 3 2 3 1 3 2 3 2 +1 2 3 2 3 1 3 2 3 2 +2 3 1 2 3 1 3 2 1 1 +2 3 1 2 3 1 3 2 3 2 +2 3 1 2 3 1 3 2 3 2 +2 3 3 2 3 1 3 2 1 1 +2 3 3 2 3 1 3 2 3 2 +2 3 3 2 3 1 3 2 3 2 + -- !multi_count_without_gby -- PhysicalCteAnchor ( cteId=CTEId#0 ) --PhysicalCteProducer ( cteId=CTEId#0 ) diff --git a/regression-test/suites/nereids_rules_p0/distinct_split/disitinct_split.groovy b/regression-test/suites/nereids_rules_p0/distinct_split/disitinct_split.groovy index eec9609e12facc6..8eec103a334fbc6 100644 --- a/regression-test/suites/nereids_rules_p0/distinct_split/disitinct_split.groovy +++ b/regression-test/suites/nereids_rules_p0/distinct_split/disitinct_split.groovy @@ -113,7 +113,7 @@ suite("distinct_split") { qt_count_multi_sum_avg_no_gby "select sum(distinct b), count(distinct a,d), avg(distinct c) from test_distinct_multi" qt_count_sum_avg_with_gby "select sum(distinct b), count(distinct a), avg(distinct c) from test_distinct_multi group by b,a order by 1,2,3" qt_count_multi_sum_avg_with_gby "select sum(distinct b), count(distinct a,d), avg(distinct c) from test_distinct_multi group by a,b order by 1,2,3" - +//这里以下还需要验证结果 // There is a reference query in the upper layer qt_multi_sum_has_upper """select c1+ c2 from (select sum(distinct b) c1, sum(distinct a) c2 from test_distinct_multi) t""" qt_000_count_has_upper """select abs(c1) from (select count(distinct a) c1 from test_distinct_multi) t""" @@ -161,6 +161,23 @@ suite("distinct_split") { t3 as (select sum(distinct a), count(distinct b) from test_distinct_multi) select * from t1,t2,t3) tmp) t """ + qt_cte_consumer_count_multi_column_with_group_by """with t1 as (select count(distinct a,b), count(distinct b,c) from test_distinct_multi group by d) + select * from t1 t cross join t1 tt order by 1,2,3,4;""" + qt_cte_consumer_count_multi_column_without_group_by """with t1 as (select sum(distinct a), count(distinct b,c) from test_distinct_multi) + select * from t1 t cross join t1 tt;""" + qt_cte_multi_producer_multi_column """ + with t1 as (select count(distinct a), count(distinct b,d) from test_distinct_multi group by c), + t2 as (select sum(distinct a), sum(distinct b) from test_distinct_multi group by c), + t3 as (select sum(distinct a), count(distinct b) from test_distinct_multi) + select * from t1,t2,t3 order by 1,2,3,4,5,6; + """ + qt_cte_multi_nested """ + with tmp as (with t1 as (select count(distinct a), count(distinct b,d) from test_distinct_multi group by c), + t2 as (select sum(distinct a), sum(distinct b) from test_distinct_multi group by c), + t3 as (select sum(distinct a), count(distinct b) from test_distinct_multi) + select * from t1,t2,t3) + select * from tmp, (select sum(distinct a), count(distinct b,c) from test_distinct_multi) t, (select sum(distinct a), count(distinct b,c) from test_distinct_multi group by d) tt order by 1,2,3,4,5,6,7,8,9,10 + """ // shape sql "SET ignore_shape_nodes='PhysicalDistribute,PhysicalProject'" diff --git a/regression-test/suites/nereids_rules_p0/mv/agg_without_roll_up/aggregate_without_roll_up.groovy b/regression-test/suites/nereids_rules_p0/mv/agg_without_roll_up/aggregate_without_roll_up.groovy index 356b96267a88f5f..f5545bc41b22df2 100644 --- a/regression-test/suites/nereids_rules_p0/mv/agg_without_roll_up/aggregate_without_roll_up.groovy +++ b/regression-test/suites/nereids_rules_p0/mv/agg_without_roll_up/aggregate_without_roll_up.groovy @@ -360,7 +360,7 @@ suite("aggregate_without_roll_up") { "from orders " + "where O_ORDERDATE < '2023-12-30' and O_ORDERDATE > '2023-12-01'" order_qt_query3_0_before "${query3_0}" - async_mv_rewrite_success(db, mv3_0, query3_0, "mv3_0") + async_mv_rewrite_fail(db, mv3_0, query3_0, "mv3_0") order_qt_query3_0_after "${query3_0}" sql """ DROP MATERIALIZED VIEW IF EXISTS mv3_0""" @@ -883,7 +883,7 @@ suite("aggregate_without_roll_up") { "on lineitem.L_ORDERKEY = orders.O_ORDERKEY " + "where orders.O_ORDERDATE < '2023-12-30' and orders.O_ORDERDATE > '2023-12-01' " order_qt_query20_0_before "${query20_0}" - async_mv_rewrite_success(db, mv20_0, query20_0, "mv20_0") + async_mv_rewrite_fail(db, mv20_0, query20_0, "mv20_0") order_qt_query20_0_after "${query20_0}" sql """ DROP MATERIALIZED VIEW IF EXISTS mv20_0""" diff --git a/regression-test/suites/nereids_rules_p0/mv/dimension/dimension_2_3.groovy b/regression-test/suites/nereids_rules_p0/mv/dimension/dimension_2_3.groovy index c7ee359cdef2e4d..a50d77bf3cc9f89 100644 --- a/regression-test/suites/nereids_rules_p0/mv/dimension/dimension_2_3.groovy +++ b/regression-test/suites/nereids_rules_p0/mv/dimension/dimension_2_3.groovy @@ -145,7 +145,7 @@ suite("partition_mv_rewrite_dimension_2_3") { count(*) from orders_2_3 left join lineitem_2_3 on lineitem_2_3.l_orderkey = orders_2_3.o_orderkey""" - mv_rewrite_success(sql_stmt_1, mv_name_1) + mv_rewrite_fail(sql_stmt_1, mv_name_1) compare_res(sql_stmt_1 + " order by 1,2,3,4,5,6") sql """DROP MATERIALIZED VIEW IF EXISTS ${mv_name_1};""" diff --git a/regression-test/suites/nereids_rules_p0/mv/dimension/dimension_2_4.groovy b/regression-test/suites/nereids_rules_p0/mv/dimension/dimension_2_4.groovy index e59b2771dd4e574..05c57974389ac3e 100644 --- a/regression-test/suites/nereids_rules_p0/mv/dimension/dimension_2_4.groovy +++ b/regression-test/suites/nereids_rules_p0/mv/dimension/dimension_2_4.groovy @@ -577,7 +577,7 @@ suite("partition_mv_rewrite_dimension_2_4") { count(distinct case when O_SHIPPRIORITY > 2 and o_orderkey IN (2) then o_custkey else null end) as cnt_2 from orders_2_4 where o_orderkey > (-3) + 5 """ - mv_rewrite_success(sql_stmt_13, mv_name_13) + mv_rewrite_fail(sql_stmt_13, mv_name_13) compare_res(sql_stmt_13 + " order by 1") sql """DROP MATERIALIZED VIEW IF EXISTS ${mv_name_13};"""