Skip to content

Commit

Permalink
fix regression
Browse files Browse the repository at this point in the history
  • Loading branch information
feiniaofeiafei committed Dec 12, 2024
1 parent fd21d34 commit fbdbae1
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down Expand Up @@ -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'"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"""

Expand Down Expand Up @@ -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"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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};"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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};"""

Expand Down

0 comments on commit fbdbae1

Please sign in to comment.