Skip to content

Commit

Permalink
fix regression case
Browse files Browse the repository at this point in the history
  • Loading branch information
seawinde committed Nov 27, 2024
1 parent f51a916 commit 4ccd6c6
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ suite ("multiple_no_where") {

sql """analyze table lineorder_flat with sync;"""
sql """set enable_stats=false;"""
sql """alter table lineorder_flat modify column LO_ORDERDATE set stats ('row_count'='8');"""

mv_rewrite_success("""SELECT SUM(LO_EXTENDEDPRICE * LO_DISCOUNT) AS revenue
FROM lineorder_flat
Expand Down
2 changes: 1 addition & 1 deletion regression-test/suites/mv_p0/test_28741/test_28741.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ suite ("test_28741") {
sql """analyze table test with sync;"""
sql """set enable_stats=false;"""

sql """alter table test modify column a set stats ('row_count'='2');"""
mv_rewrite_fail("select b1 from test where t >= '2023-12-20 17:21:00'", "mv_test")

sql """set enable_stats=true;"""
sql """alter table test modify column a set stats ('row_count'='2');"""
mv_rewrite_fail("select b1 from test where t >= '2023-12-20 17:21:00'", "mv_test")
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ suite ("test_dup_group_by_mv_abs") {
sql """analyze table d_table with sync;"""
sql """set enable_stats=false;"""

sql """alter table d_table modify column k1 set stats ('row_count'='4');"""
qt_select_star "select * from d_table order by k1;"

mv_rewrite_success("select k1,sum(abs(k2)) from d_table group by k1;", "k12sa")
Expand All @@ -54,6 +53,7 @@ suite ("test_dup_group_by_mv_abs") {
qt_select_mv_sub "select sum(abs(k2)) from d_table group by k1 order by k1;"

sql """set enable_stats=true;"""
sql """alter table d_table modify column k1 set stats ('row_count'='4');"""
mv_rewrite_success("select k1,sum(abs(k2)) from d_table group by k1;", "k12sa")
mv_rewrite_success("select sum(abs(k2)) from d_table group by k1;", "k12sa")
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ suite ("test_dup_mv_plus") {
qt_select_mv "select k1,k2+1 from d_table order by k2;"

sql """set enable_stats=true;"""
sql """alter table table_ngrambf modify column siteid set stats ('row_count'='2');"""
sql """alter table d_table modify column k4 set stats ('row_count'='3');"""
mv_rewrite_success("select k1,k2+1 from d_table order by k1;", "k12p")

mv_rewrite_success("select k2+1 from d_table order by k1;", "k12p")
Expand Down
2 changes: 1 addition & 1 deletion regression-test/suites/mv_p0/test_mv_dp/test_mv_dp.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ suite ("test_mv_dp") {
}
*/

sql """alter table dp modify column d set stats ('row_count'='4');"""
mv_rewrite_success("""select d,
bitmap_union_count(bitmap_from_array(cast(uid_list as array<bigint>))),
bitmap_union_count(bitmap_from_array(if(status='success', cast(uid_list as array<bigint>), array())))
Expand All @@ -70,6 +69,7 @@ suite ("test_mv_dp") {
from dp
group by d order by 1;"""
sql """set enable_stats=true;"""
sql """alter table dp modify column d set stats ('row_count'='4');"""
mv_rewrite_success("""select d,
bitmap_union_count(bitmap_from_array(cast(uid_list as array<bigint>))),
bitmap_union_count(bitmap_from_array(if(status='success', cast(uid_list as array<bigint>), array())))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ suite ("testAggQuqeryOnAggMV7") {
sql """analyze table emps with sync;"""
sql """set enable_stats=false;"""

sql """alter table emps modify column time_col set stats ('row_count'='4');"""

mv_rewrite_fail("select * from emps order by empid;", "emps_mv")
qt_select_star "select * from emps order by empid;"

Expand All @@ -53,6 +51,7 @@ suite ("testAggQuqeryOnAggMV7") {

sql """set enable_stats=true;"""
sql """alter table emps modify column time_col set stats ('row_count'='4');"""
sql """alter table emps modify column time_col set stats ('row_count'='4');"""
mv_rewrite_fail("select * from emps order by empid;", "emps_mv")

mv_rewrite_success("select deptno, sum(salary) from emps where deptno>=20 group by deptno;", "emps_mv")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,7 @@ suite("aggregate_with_roll_up") {
bitmap_union(to_bitmap(case when o_shippriority > 1 and o_orderkey IN (3, 4, 5) then o_custkey else null end)),
bitmap_union_count(to_bitmap(case when o_shippriority > 0 and o_orderkey IN (1, 2, 3) then o_custkey else null end)),
bitmap_union_count(to_bitmap(case when o_shippriority > 1 and o_orderkey IN (3, 4, 5) then o_custkey else null end)),
bitmap_union_count(to_bitmap(case when o_shippriority > 0 and o_orderkey IN (1, 2, 3) then o_custkey else null end)) + bitmap_union_count(to_bitmap(case when o_shippriority > 1 and o_orderkey IN (3, 4, 5) then o_custkey else null end)),
count(distinct case when o_shippriority > 1 and o_orderkey IN (3, 4, 5) then o_custkey else null end)
from lineitem
left join orders on l_orderkey = o_orderkey and l_shipdate = o_orderdate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,10 @@ suite("partition_mv_rewrite_dimension_2_6") {
(3, null, 1, 99.5, 'yy');
"""

sql """insert into orders_2_6 values (...);"""
sql """alter table orders_2_6 modify column o_comment set stats ('row_count'='10');"""

sql """insert into lineitem_2_6 values (...);"""
sql """alter table lineitem_2_6 modify column l_comment set stats ('row_count'='7');"""

sql """insert into partsupp_2_6 values (...);"""
sql """alter table partsupp_2_6 modify column ps_comment set stats ('row_count'='3');"""

sql """analyze table orders_2_6 with sync;"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1376,8 +1376,9 @@ suite("other_join_conjuncts_outer") {
ps_partkey
from
orders
full outer join lineitem on l_orderkey = o_orderkey
full outer join partsupp on ps_partkey = l_partkey;
full outer join lineitem on l_orderkey = o_orderkey and l_shipdate <= o_orderdate
full outer join partsupp on ps_partkey = l_partkey
where l_orderkey + o_orderkey != ps_availqty;
"""
def query9_4 =
"""
Expand All @@ -1389,9 +1390,8 @@ suite("other_join_conjuncts_outer") {
ps_partkey
from
orders
full outer join lineitem on l_orderkey = o_orderkey and l_shipdate < o_orderdate
full outer join partsupp on ps_partkey = l_partkey
where l_orderkey + o_orderkey != ps_availqty;
full outer join lineitem on l_orderkey = o_orderkey
full outer join partsupp on ps_partkey = l_partkey;
"""
order_qt_query9_4_before "${query9_4}"
// mv has other conjuncts but query not
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ suite("single_table_without_aggregate") {
"""

sql "analyze table orders with sync;"
sql """set enable_stats=false;"""

sql """alter table orders modify column o_comment set stats ('row_count'='2');"""
sql """set enable_stats=false;"""

def check_rewrite = { mv_sql, query_sql, mv_name ->

Expand Down
2 changes: 0 additions & 2 deletions regression-test/suites/nereids_syntax_p0/mv/ut/onStar.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,4 @@ suite ("onStar") {
sql """insert into onStar_tpch values(1,'a','a');"""

order_qt_select_mv "select ref_1.`empid` as c0 from onStar_tpch as ref_0 left join onStar as ref_1 on (ref_0.`r_comment` = ref_1.`name` ) where true order by ref_0.`r_regionkey`,ref_0.`r_regionkey` desc ,ref_0.`r_regionkey`,ref_0.`r_regionkey`;"

sql """alter table onStar_tpch modify column r_regionkey set stats ('row_count'='1');"""
}

0 comments on commit 4ccd6c6

Please sign in to comment.