diff --git a/regression-test/suites/mv_p0/agg_have_dup_base/agg_have_dup_base.groovy b/regression-test/suites/mv_p0/agg_have_dup_base/agg_have_dup_base.groovy index ece526b1e24e7a..888d51e48d7b4b 100644 --- a/regression-test/suites/mv_p0/agg_have_dup_base/agg_have_dup_base.groovy +++ b/regression-test/suites/mv_p0/agg_have_dup_base/agg_have_dup_base.groovy @@ -43,6 +43,7 @@ suite ("agg_have_dup_base") { sql "insert into d_table select -4,-4,-4,'d';" sql "analyze table d_table with sync;" + sql """alter table d_table modify column k4 set stats ('row_count'='5');""" sql """set enable_stats=false;""" qt_select_star "select * from d_table order by k1;" @@ -60,7 +61,6 @@ suite ("agg_have_dup_base") { qt_select_mv "select unix_timestamp(k1) tmp,sum(k2) from d_table group by tmp order by tmp;" sql """set enable_stats=true;""" - sql """alter table d_table modify column k4 set stats ('row_count'='5');""" mv_rewrite_success("select k1,sum(k2),max(k2) from d_table group by k1;", "k12s3m") diff --git a/regression-test/suites/mv_p0/agg_state/test_agg_state_max_by.groovy b/regression-test/suites/mv_p0/agg_state/test_agg_state_max_by.groovy index 29190396230dce..a1d49c30bbd430 100644 --- a/regression-test/suites/mv_p0/agg_state/test_agg_state_max_by.groovy +++ b/regression-test/suites/mv_p0/agg_state/test_agg_state_max_by.groovy @@ -64,12 +64,12 @@ suite ("test_agg_state_max_by") { } sql "analyze table d_table with sync;" + sql """alter table d_table modify column k4 set stats ('row_count'='8');""" sql """set enable_stats=false;""" qt_select_star "select * from d_table order by 1,2;" mv_rewrite_success("select k1,max_by(k2,k3) from d_table group by k1 order by 1,2;", "k1mb") sql """set enable_stats=true;""" - sql """alter table d_table modify column k4 set stats ('row_count'='8');""" mv_rewrite_success("select k1,max_by(k2,k3) from d_table group by k1 order by 1,2;", "k1mb") qt_select_mv "select k1,max_by(k2,k3) from d_table group by k1 order by 1,2;" diff --git a/regression-test/suites/mv_p0/case_ignore/case_ignore.groovy b/regression-test/suites/mv_p0/case_ignore/case_ignore.groovy index 271eb0cb5ed190..2223528e41fe03 100644 --- a/regression-test/suites/mv_p0/case_ignore/case_ignore.groovy +++ b/regression-test/suites/mv_p0/case_ignore/case_ignore.groovy @@ -44,6 +44,7 @@ suite ("case_ignore") { sql "insert into d_table select -4,-4,-4,'d';" sql "analyze table d_table with sync;" + sql """alter table d_table modify column k4 set stats ('row_count'='8');""" sql """set enable_stats=false;""" qt_select_star "select * from d_table order by k1;" diff --git a/regression-test/suites/mv_p0/count_star/count_star.groovy b/regression-test/suites/mv_p0/count_star/count_star.groovy index 4d951d76fa98a9..1afd0375ef8bd3 100644 --- a/regression-test/suites/mv_p0/count_star/count_star.groovy +++ b/regression-test/suites/mv_p0/count_star/count_star.groovy @@ -45,6 +45,7 @@ suite ("count_star") { sql "insert into d_table values(2,1,1,'a'),(2,1,1,'a');" sql "analyze table d_table with sync;" + sql """alter table d_table modify column k4 set stats ('row_count'='8');""" sql """set enable_stats=false;""" qt_select_star "select * from d_table order by k1,k2,k3,k4;" @@ -65,7 +66,6 @@ suite ("count_star") { sql """set enable_stats=true;""" - sql """alter table d_table modify column k4 set stats ('row_count'='8');""" mv_rewrite_success("select k1,k4,count(*) from d_table group by k1,k4;", "kstar") mv_rewrite_success("select k1,k4,count(*) from d_table where k1=1 group by k1,k4;", "kstar") mv_rewrite_fail("select k1,k4,count(*) from d_table where k3=1 group by k1,k4;", "kstar") diff --git a/regression-test/suites/mv_p0/dis_26495/dis_26495.groovy b/regression-test/suites/mv_p0/dis_26495/dis_26495.groovy index 14ebb67ddc8168..d6965c24729b89 100644 --- a/regression-test/suites/mv_p0/dis_26495/dis_26495.groovy +++ b/regression-test/suites/mv_p0/dis_26495/dis_26495.groovy @@ -30,6 +30,8 @@ suite ("dis_26495") { sql """alter table doris_test modify column agg_st_1 set stats ('row_count'='1');""" + sql """set enable_stats=false;""" + streamLoad { table "doris_test" set 'column_separator', ',' diff --git a/regression-test/suites/mv_p0/k1ap2spa/k1ap2spa.groovy b/regression-test/suites/mv_p0/k1ap2spa/k1ap2spa.groovy index b4c2921669663a..a48853b8bccbba 100644 --- a/regression-test/suites/mv_p0/k1ap2spa/k1ap2spa.groovy +++ b/regression-test/suites/mv_p0/k1ap2spa/k1ap2spa.groovy @@ -44,6 +44,8 @@ suite ("k1ap2spa") { qt_select_star "select * from d_table order by k1;" + sql """alter table d_table modify column k1 set stats ('row_count'='5');""" + sql "analyze table d_table with sync;" sql """set enable_stats=false;""" @@ -52,8 +54,6 @@ suite ("k1ap2spa") { sql """set enable_stats=true;""" - sql """alter table d_table modify column k1 set stats ('row_count'='5');""" - mv_rewrite_success("select abs(k1)+1 t,sum(abs(k2+1)) from d_table group by t order by t;", "k1ap2spa") } diff --git a/regression-test/suites/mv_p0/k1s2m3_auto_inc/k1s2m3_auto_inc.groovy b/regression-test/suites/mv_p0/k1s2m3_auto_inc/k1s2m3_auto_inc.groovy index 17583741e68b91..97dc5cbd9ff78b 100644 --- a/regression-test/suites/mv_p0/k1s2m3_auto_inc/k1s2m3_auto_inc.groovy +++ b/regression-test/suites/mv_p0/k1s2m3_auto_inc/k1s2m3_auto_inc.groovy @@ -51,12 +51,12 @@ suite ("k1s2m3_auto_inc") { qt_select_star "select * from d_table order by k1;" sql "analyze table d_table with sync;" + sql """alter table d_table modify column k1 set stats ('row_count'='2');""" sql """set enable_stats=false;""" mv_rewrite_success("select k3,sum(abs(k2+1)) from d_table group by k3 order by 1;", "k3ap2spa") qt_select_mv "select k3,sum(abs(k2+1)) from d_table group by k3 order by 1;" sql """set enable_stats=true;""" - sql """alter table d_table modify column k1 set stats ('row_count'='2');""" mv_rewrite_success("select k3,sum(abs(k2+1)) from d_table group by k3 order by 1;", "k3ap2spa") } diff --git a/regression-test/suites/mv_p0/multi_agg_with_same_slot/multi_agg_with_same_slot.groovy b/regression-test/suites/mv_p0/multi_agg_with_same_slot/multi_agg_with_same_slot.groovy index 538d050fec8a9d..a0580c458a8e68 100644 --- a/regression-test/suites/mv_p0/multi_agg_with_same_slot/multi_agg_with_same_slot.groovy +++ b/regression-test/suites/mv_p0/multi_agg_with_same_slot/multi_agg_with_same_slot.groovy @@ -46,6 +46,7 @@ suite ("multi_agg_with_same_slot") { sql "insert into d_table(k4,k2,k5) values('d',4,4);" sql "analyze table d_table with sync;" + sql """alter table d_table modify column k1 set stats ('row_count'='5');""" sql """set enable_stats=false;""" qt_select_star "select * from d_table order by k1;" @@ -64,7 +65,6 @@ suite ("multi_agg_with_same_slot") { sql """set enable_stats=true;""" - sql """alter table d_table modify column k1 set stats ('row_count'='5');""" mv_rewrite_success("select k1,k2,avg(k3),max(k3) from d_table group by k1,k2 order by 1,2;", "kmv") mv_rewrite_success("select k1,k2,avg(k3)+max(k3) from d_table group by k1,k2 order by 1,2;", "kmv") mv_rewrite_success("select k1,k2,avg(k3)+max(k3) from d_table group by grouping sets((k1),(k1,k2),()) order by 1,2;", "kmv") diff --git a/regression-test/suites/mv_p0/multi_slot_k123p/multi_slot_k123p.groovy b/regression-test/suites/mv_p0/multi_slot_k123p/multi_slot_k123p.groovy index 154939a6bb5ef3..30ca215763a008 100644 --- a/regression-test/suites/mv_p0/multi_slot_k123p/multi_slot_k123p.groovy +++ b/regression-test/suites/mv_p0/multi_slot_k123p/multi_slot_k123p.groovy @@ -52,6 +52,7 @@ suite ("multi_slot_k123p") { } sql """sync""" sql "analyze table d_table with sync;" + sql """alter table d_table modify column k1 set stats ('row_count'='5');""" sql """set enable_stats=false;""" qt_select_star "select * from d_table order by k1,k4;" @@ -63,6 +64,5 @@ suite ("multi_slot_k123p") { qt_select_mv "select k1,version() from d_table order by k1;" sql """set enable_stats=true;""" - sql """alter table d_table modify column k1 set stats ('row_count'='5');""" mv_rewrite_success("select k1,k2+k3 from d_table order by k1;", "k123p") } diff --git a/regression-test/suites/mv_p0/multi_slot_k1a2p2ap3p/multi_slot_k1a2p2ap3p.groovy b/regression-test/suites/mv_p0/multi_slot_k1a2p2ap3p/multi_slot_k1a2p2ap3p.groovy index fc722c5a07fbe7..15963c8efb14a9 100644 --- a/regression-test/suites/mv_p0/multi_slot_k1a2p2ap3p/multi_slot_k1a2p2ap3p.groovy +++ b/regression-test/suites/mv_p0/multi_slot_k1a2p2ap3p/multi_slot_k1a2p2ap3p.groovy @@ -45,13 +45,13 @@ suite ("multi_slot_k1a2p2ap3p") { qt_select_star "select * from d_table order by k1;" sql "analyze table d_table with sync;" + sql """alter table d_table modify column k1 set stats ('row_count'='7');""" sql """set enable_stats=false;""" mv_rewrite_success("select abs(k1)+k2+1,abs(k2+2)+k3+3 from d_table order by abs(k1)+k2+1,abs(k2+2)+k3+3", "k1a2p2ap3p") qt_select_mv "select abs(k1)+k2+1,abs(k2+2)+k3+3 from d_table order by abs(k1)+k2+1,abs(k2+2)+k3+3;" sql """set enable_stats=true;""" - sql """alter table d_table modify column k1 set stats ('row_count'='7');""" mv_rewrite_success("select abs(k1)+k2+1,abs(k2+2)+k3+3 from d_table order by abs(k1)+k2+1,abs(k2+2)+k3+3", "k1a2p2ap3p") } diff --git a/regression-test/suites/mv_p0/multi_slot_k1a2p2ap3ps/multi_slot_k1a2p2ap3ps.groovy b/regression-test/suites/mv_p0/multi_slot_k1a2p2ap3ps/multi_slot_k1a2p2ap3ps.groovy index b2292084504199..f005243a871fbf 100644 --- a/regression-test/suites/mv_p0/multi_slot_k1a2p2ap3ps/multi_slot_k1a2p2ap3ps.groovy +++ b/regression-test/suites/mv_p0/multi_slot_k1a2p2ap3ps/multi_slot_k1a2p2ap3ps.groovy @@ -50,6 +50,7 @@ suite ("multi_slot_k1a2p2ap3ps") { sql "insert into d_table select -4,-4,-4,'d';" sql "analyze table d_table with sync;" + sql """alter table d_table modify column k1 set stats ('row_count'='4');""" sql """set enable_stats=false;""" qt_select_star "select * from d_table order by k1;" @@ -60,8 +61,6 @@ suite ("multi_slot_k1a2p2ap3ps") { mv_rewrite_fail("select abs(k1)+k2+1,sum(abs(k2+2)+k3+3) from d_table group by abs(k1)+k2 order by abs(k1)+k2", "k1a2p2ap3ps") qt_select_base "select abs(k1)+k2+1,sum(abs(k2+2)+k3+3) from d_table group by abs(k1)+k2 order by abs(k1)+k2;" - sql """set enable_stats=true;""" - sql """alter table d_table modify column k1 set stats ('row_count'='4');""" mv_rewrite_success("select abs(k1)+k2+1,sum(abs(k2+2)+k3+3) from d_table group by abs(k1)+k2+1 order by abs(k1)+k2+1", "k1a2p2ap3ps") mv_rewrite_fail("select abs(k1)+k2+1,sum(abs(k2+2)+k3+3) from d_table group by abs(k1)+k2 order by abs(k1)+k2", "k1a2p2ap3ps") diff --git a/regression-test/suites/mv_p0/multi_slot_k1p2ap3p/multi_slot_k1p2ap3p.groovy b/regression-test/suites/mv_p0/multi_slot_k1p2ap3p/multi_slot_k1p2ap3p.groovy index 75bbd3fb4b7bb8..84aeabf0e680e0 100644 --- a/regression-test/suites/mv_p0/multi_slot_k1p2ap3p/multi_slot_k1p2ap3p.groovy +++ b/regression-test/suites/mv_p0/multi_slot_k1p2ap3p/multi_slot_k1p2ap3p.groovy @@ -42,6 +42,7 @@ suite ("multi_slot_k1p2ap3p") { sql "insert into d_table select -4,-4,-4,'d';" sql "analyze table d_table with sync;" + sql """alter table d_table modify column k1 set stats ('row_count'='4');""" sql """set enable_stats=false;""" qt_select_star "select * from d_table order by k1;" @@ -50,6 +51,5 @@ suite ("multi_slot_k1p2ap3p") { qt_select_mv "select k1+1,abs(k2+2)+k3+3 from d_table order by k1+1;" sql """set enable_stats=true;""" - sql """alter table d_table modify column k1 set stats ('row_count'='4');""" mv_rewrite_success("select k1+1,abs(k2+2)+k3+3 from d_table order by k1+1;", "k1p2ap3p") } diff --git a/regression-test/suites/mv_p0/multi_slot_k1p2ap3ps/multi_slot_k1p2ap3ps.groovy b/regression-test/suites/mv_p0/multi_slot_k1p2ap3ps/multi_slot_k1p2ap3ps.groovy index 2ed75247e8ea29..248cfbbb33f7b7 100644 --- a/regression-test/suites/mv_p0/multi_slot_k1p2ap3ps/multi_slot_k1p2ap3ps.groovy +++ b/regression-test/suites/mv_p0/multi_slot_k1p2ap3ps/multi_slot_k1p2ap3ps.groovy @@ -42,6 +42,7 @@ suite ("multi_slot_k1p2ap3ps") { sql "insert into d_table select -4,-4,-4,'d';" sql "analyze table d_table with sync;" + sql """alter table d_table modify column k1 set stats ('row_count'='5');""" sql """set enable_stats=false;""" qt_select_star "select * from d_table order by k1;" @@ -50,6 +51,5 @@ suite ("multi_slot_k1p2ap3ps") { qt_select_mv "select k1+1,sum(abs(k2+2)+k3+3) from d_table group by k1+1 order by k1+1;" sql """set enable_stats=true;""" - sql """alter table d_table modify column k1 set stats ('row_count'='5');""" mv_rewrite_success("select k1+1,sum(abs(k2+2)+k3+3) from d_table group by k1+1 order by k1+1;", "k1p2ap3ps") } diff --git a/regression-test/suites/mv_p0/multi_slot_multi_mv/multi_slot_multi_mv.groovy b/regression-test/suites/mv_p0/multi_slot_multi_mv/multi_slot_multi_mv.groovy index 172e3217dafe4d..00eee46c9cd8ea 100644 --- a/regression-test/suites/mv_p0/multi_slot_multi_mv/multi_slot_multi_mv.groovy +++ b/regression-test/suites/mv_p0/multi_slot_multi_mv/multi_slot_multi_mv.groovy @@ -45,6 +45,7 @@ suite ("multi_slot_multi_mv") { qt_select_star "select * from d_table order by k1;" sql "analyze table d_table with sync;" + sql """alter table d_table modify column k1 set stats ('row_count'='5');""" sql """set enable_stats=false;""" def retry_times = 60 @@ -82,7 +83,6 @@ suite ("multi_slot_multi_mv") { qt_select_mv "select abs(k1)+k2+1,abs(k2+2)+k3+3 from d_table order by abs(k1)+k2+1,abs(k2+2)+k3+3;" sql """set enable_stats=true;""" - sql """alter table d_table modify column k1 set stats ('row_count'='5');""" for (def i = 0; i < retry_times; ++i) { boolean is_k1a2p2ap3p = false boolean is_k1a2p2ap3ps = false diff --git a/regression-test/suites/mv_p0/mv_with_view/mv_with_view.groovy b/regression-test/suites/mv_p0/mv_with_view/mv_with_view.groovy index f2e389e867a564..dfdf02665c3b97 100644 --- a/regression-test/suites/mv_p0/mv_with_view/mv_with_view.groovy +++ b/regression-test/suites/mv_p0/mv_with_view/mv_with_view.groovy @@ -41,6 +41,7 @@ suite ("mv_with_view") { sql """insert into d_table select 3,-3,null,'c';""" sql "analyze table d_table with sync;" + sql """alter table d_table modify column k1 set stats ('row_count'='3');""" sql """set enable_stats=false;""" mv_rewrite_fail("select * from d_table order by k1;", "k312") @@ -67,7 +68,6 @@ suite ("mv_with_view") { qt_select_mv "select * from v_k124 order by k1;" sql """set enable_stats=true;""" - sql """alter table d_table modify column k1 set stats ('row_count'='3');""" mv_rewrite_fail("select * from d_table order by k1;", "k312") sql """ diff --git a/regression-test/suites/mv_p0/routine_load_hll/routine_load_hll.groovy b/regression-test/suites/mv_p0/routine_load_hll/routine_load_hll.groovy index d34024ebdf5068..f24b9e783af9f1 100644 --- a/regression-test/suites/mv_p0/routine_load_hll/routine_load_hll.groovy +++ b/regression-test/suites/mv_p0/routine_load_hll/routine_load_hll.groovy @@ -52,12 +52,12 @@ suite ("routine_load_hll") { qt_select "select event_id,time_stamp,hll_cardinality(device_id) from test order by 1,2;" sql "analyze table test with sync;" + sql """alter table test modify column event_id set stats ('row_count'='2');""" sql """set enable_stats=false;""" mv_rewrite_success("select time_stamp, hll_union_agg(device_id) from test group by time_stamp order by 1;", "m_view") qt_select_mv "select time_stamp, hll_union_agg(device_id) from test group by time_stamp order by 1;" sql """set enable_stats=true;""" - sql """alter table test modify column event_id set stats ('row_count'='2');""" mv_rewrite_success("select time_stamp, hll_union_agg(device_id) from test group by time_stamp order by 1;", "m_view") } diff --git a/regression-test/suites/mv_p0/ssb/multiple_ssb/multiple_ssb.groovy b/regression-test/suites/mv_p0/ssb/multiple_ssb/multiple_ssb.groovy index e0dc916c05b66a..441f9fd7a32fe6 100644 --- a/regression-test/suites/mv_p0/ssb/multiple_ssb/multiple_ssb.groovy +++ b/regression-test/suites/mv_p0/ssb/multiple_ssb/multiple_ssb.groovy @@ -153,6 +153,7 @@ suite ("multiple_ssb") { qt_select_star "select * from lineorder_flat order by 1,2,LO_ORDERPRIORITY, P_MFGR;" sql """analyze table lineorder_flat with sync;""" + sql """alter table lineorder_flat modify column LO_ORDERDATE set stats ('row_count'='8');""" sql """set enable_stats=false;""" mv_rewrite_success("""SELECT SUM(LO_EXTENDEDPRICE * LO_DISCOUNT) AS revenue @@ -240,7 +241,6 @@ suite ("multiple_ssb") { qt_select_count_3 "select LO_ORDERPRIORITY, count(1) from lineorder_flat where LO_ORDERPRIORITY in ('1','2','3') group by LO_ORDERPRIORITY order by 1,2;" sql """set enable_stats=true;""" - 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 WHERE diff --git a/regression-test/suites/mv_p0/ssb/q_4_1_r1/q_4_1_r1.groovy b/regression-test/suites/mv_p0/ssb/q_4_1_r1/q_4_1_r1.groovy index ebeb23d96e75e5..a12853573f16ab 100644 --- a/regression-test/suites/mv_p0/ssb/q_4_1_r1/q_4_1_r1.groovy +++ b/regression-test/suites/mv_p0/ssb/q_4_1_r1/q_4_1_r1.groovy @@ -95,6 +95,7 @@ suite ("q_4_1_r1") { qt_select_star "select * from lineorder_flat order by 1,2,P_MFGR;" sql """analyze table lineorder_flat with sync;""" + sql """alter table lineorder_flat modify column LO_ORDERDATE set stats ('row_count'='8');""" sql """set enable_stats=false;""" mv_rewrite_success("""SELECT (LO_ORDERDATE DIV 10000) AS YEAR, @@ -119,7 +120,6 @@ suite ("q_4_1_r1") { GROUP BY YEAR, C_NATION ORDER BY YEAR ASC, C_NATION ASC;""" sql """set enable_stats=true;""" - sql """alter table lineorder_flat modify column LO_ORDERDATE set stats ('row_count'='8');""" mv_rewrite_success("""SELECT (LO_ORDERDATE DIV 10000) AS YEAR, C_NATION, SUM(LO_REVENUE - LO_SUPPLYCOST) AS profit diff --git a/regression-test/suites/mv_p0/sum_divede_count/sum_devide_count.groovy b/regression-test/suites/mv_p0/sum_divede_count/sum_devide_count.groovy index 85a3f7137b9e40..1784851e0470ff 100644 --- a/regression-test/suites/mv_p0/sum_divede_count/sum_devide_count.groovy +++ b/regression-test/suites/mv_p0/sum_divede_count/sum_devide_count.groovy @@ -44,6 +44,7 @@ suite ("sum_devide_count") { qt_select_star "select * from d_table order by k1,k2,k3,k4;" sql """analyze table d_table with sync;""" + sql """alter table d_table modify column k1 set stats ('row_count'='5');""" sql """set enable_stats=false;""" @@ -60,7 +61,6 @@ suite ("sum_devide_count") { qt_select_mv "select sum(k2)/count(k2) from d_table;" sql """set enable_stats=true;""" - sql """alter table d_table modify column k1 set stats ('row_count'='5');""" mv_rewrite_success("select k1,k4,sum(k2)/count(k2) from d_table group by k1,k4 order by k1,k4;", "kavg") mv_rewrite_success("select k1,sum(k2)/count(k2) from d_table group by k1 order by k1;", "kavg") diff --git a/regression-test/suites/mv_p0/test_28741/test_28741.groovy b/regression-test/suites/mv_p0/test_28741/test_28741.groovy index 88fb3c057da092..2243b173f3f1d9 100644 --- a/regression-test/suites/mv_p0/test_28741/test_28741.groovy +++ b/regression-test/suites/mv_p0/test_28741/test_28741.groovy @@ -66,11 +66,11 @@ suite ("test_28741") { sql "INSERT INTO test(a,a1,b,b1,c,t,d,d1,e) VALUES (1,1,2,'-',3,'2023-12-20 17:21:00', 56, 78, 89)" sql """analyze table test with sync;""" + sql """alter table test modify column a set stats ('row_count'='2');""" sql """set enable_stats=false;""" 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") } diff --git a/regression-test/suites/mv_p0/test_approx_count_distinct/test_approx_count_distinct.groovy b/regression-test/suites/mv_p0/test_approx_count_distinct/test_approx_count_distinct.groovy index 68952da602aa81..96474dc202da81 100644 --- a/regression-test/suites/mv_p0/test_approx_count_distinct/test_approx_count_distinct.groovy +++ b/regression-test/suites/mv_p0/test_approx_count_distinct/test_approx_count_distinct.groovy @@ -38,6 +38,7 @@ suite ("test_approx_count_distinct") { sql """insert into user_tags values("2020-01-01",1,"a",2);""" sql """analyze table user_tags with sync;""" + sql """alter table user_tags modify column time_col set stats ('row_count'='3');""" sql """set enable_stats=false;""" mv_rewrite_fail("select * from user_tags order by time_col;", "user_tags_mv") @@ -50,7 +51,6 @@ suite ("test_approx_count_distinct") { qt_select_mv "select user_id, approx_count_distinct(tag_id) a from user_tags group by user_id order by user_id;" sql """set enable_stats=true;""" - sql """alter table user_tags modify column time_col set stats ('row_count'='3');""" mv_rewrite_fail("select * from user_tags order by time_col;", "user_tags_mv") mv_rewrite_success("select user_id, ndv(tag_id) a from user_tags group by user_id order by user_id;", "user_tags_mv") diff --git a/regression-test/suites/mv_p0/test_base/test_base.groovy b/regression-test/suites/mv_p0/test_base/test_base.groovy index 97ece8cd6cca68..36e564e2b2037c 100644 --- a/regression-test/suites/mv_p0/test_base/test_base.groovy +++ b/regression-test/suites/mv_p0/test_base/test_base.groovy @@ -44,6 +44,7 @@ suite ("test_base") { sql """insert into dwd(id) values(2);""" sql "analyze table dwd with sync;" + sql """alter table dwd modify column id set stats ('row_count'='2');""" sql """set enable_stats=false;""" mv_rewrite_success("SELECT created_at, id FROM dwd where created_at = '2020-09-09 00:00:00' order by 1, 2;", "dwd_mv") @@ -53,7 +54,6 @@ suite ("test_base") { qt_select_mv "SELECT id,created_at FROM dwd order by 1, 2;" sql """set enable_stats=true;""" - sql """alter table dwd modify column id set stats ('row_count'='2');""" mv_rewrite_success("SELECT created_at, id FROM dwd where created_at = '2020-09-09 00:00:00' order by 1, 2;", "dwd_mv") mv_rewrite_success("SELECT id,created_at FROM dwd where id is not null order by 1, 2;", "dwd_mv") diff --git a/regression-test/suites/mv_p0/test_casewhen/test_casewhen.groovy b/regression-test/suites/mv_p0/test_casewhen/test_casewhen.groovy index 0c9e0026cb7fbd..d816d79bdadf5e 100644 --- a/regression-test/suites/mv_p0/test_casewhen/test_casewhen.groovy +++ b/regression-test/suites/mv_p0/test_casewhen/test_casewhen.groovy @@ -32,6 +32,7 @@ suite ("test_casewhen") { sql """insert into sales_records values(1,1,1,"2020-02-02",1),(1,2,2,"2020-02-02",1);""" sql """analyze table sales_records with sync;""" + sql """alter table sales_records modify column record_id set stats ('row_count'='4');""" sql """set enable_stats=false;""" qt_select_star "select * from sales_records order by 1,2;" @@ -40,6 +41,5 @@ suite ("test_casewhen") { qt_select_mv "select store_id, sum(case when sale_amt>10 then 1 else 2 end) from sales_records group by store_id order by 1;" sql """set enable_stats=true;""" - sql """alter table sales_records modify column record_id set stats ('row_count'='4');""" mv_rewrite_success("select store_id, sum(case when sale_amt>10 then 1 else 2 end) from sales_records group by store_id order by 1;", "store_amt") } diff --git a/regression-test/suites/mv_p0/test_doc_e4/test_doc_e4.groovy b/regression-test/suites/mv_p0/test_doc_e4/test_doc_e4.groovy index 517b4415bd69ea..14929952529ab7 100644 --- a/regression-test/suites/mv_p0/test_doc_e4/test_doc_e4.groovy +++ b/regression-test/suites/mv_p0/test_doc_e4/test_doc_e4.groovy @@ -42,6 +42,7 @@ suite ("test_doc_e4") { sql "insert into d_table select 3,-3,null,'2022-02-20';" sql """analyze table d_table with sync;""" + sql """alter table d_table modify column k1 set stats ('row_count'='3');""" sql """set enable_stats=false;""" mv_rewrite_success("select abs(k1)+k2+1,sum(abs(k2+2)+k3+3) from d_table group by abs(k1)+k2+1 order by 1,2;", "k1a2p2ap3ps") @@ -57,7 +58,6 @@ suite ("test_doc_e4") { qt_select_mv "select year(k4)+month(k4) from d_table where year(k4) = 2020 order by 1;" sql """set enable_stats=true;""" - sql """alter table d_table modify column k1 set stats ('row_count'='3');""" mv_rewrite_success("select abs(k1)+k2+1,sum(abs(k2+2)+k3+3) from d_table group by abs(k1)+k2+1 order by 1,2;", "k1a2p2ap3ps") mv_rewrite_success("select bin(abs(k1)+k2+1),sum(abs(k2+2)+k3+3) from d_table group by bin(abs(k1)+k2+1);", "k1a2p2ap3ps") diff --git a/regression-test/suites/mv_p0/test_dup_group_by_mv_abs/test_dup_group_by_mv_abs.groovy b/regression-test/suites/mv_p0/test_dup_group_by_mv_abs/test_dup_group_by_mv_abs.groovy index 23aeeb207f6898..e02ed171e1e2f5 100644 --- a/regression-test/suites/mv_p0/test_dup_group_by_mv_abs/test_dup_group_by_mv_abs.groovy +++ b/regression-test/suites/mv_p0/test_dup_group_by_mv_abs/test_dup_group_by_mv_abs.groovy @@ -42,6 +42,7 @@ suite ("test_dup_group_by_mv_abs") { sql "insert into d_table select -4,-4,-4,'d';" sql """analyze table d_table with sync;""" + sql """alter table d_table modify column k1 set stats ('row_count'='4');""" sql """set enable_stats=false;""" qt_select_star "select * from d_table order by k1;" @@ -53,7 +54,6 @@ 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") } diff --git a/regression-test/suites/mv_p0/test_dup_group_by_mv_plus/test_dup_group_by_mv_plus.groovy b/regression-test/suites/mv_p0/test_dup_group_by_mv_plus/test_dup_group_by_mv_plus.groovy index 3551bb8a7fb359..f492c0af76404a 100644 --- a/regression-test/suites/mv_p0/test_dup_group_by_mv_plus/test_dup_group_by_mv_plus.groovy +++ b/regression-test/suites/mv_p0/test_dup_group_by_mv_plus/test_dup_group_by_mv_plus.groovy @@ -42,6 +42,7 @@ suite ("test_dup_group_by_mv_plus") { sql "insert into d_table select -4,-4,-4,'d';" sql """analyze table d_table with sync;""" + sql """alter table d_table modify column k1 set stats ('row_count'='4');""" sql """set enable_stats=false;""" qt_select_star "select * from d_table order by k1;" @@ -53,7 +54,6 @@ suite ("test_dup_group_by_mv_plus") { qt_select_mv_sub "select sum(k2+1) 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(k2+1) from d_table group by k1;", "k12sp") mv_rewrite_success("select sum(k2+1) from d_table group by k1;", "k12sp") diff --git a/regression-test/suites/mv_p0/test_dup_mv_abs/test_dup_mv_abs.groovy b/regression-test/suites/mv_p0/test_dup_mv_abs/test_dup_mv_abs.groovy index f44c9d134f91f0..ea898c6e219e34 100644 --- a/regression-test/suites/mv_p0/test_dup_mv_abs/test_dup_mv_abs.groovy +++ b/regression-test/suites/mv_p0/test_dup_mv_abs/test_dup_mv_abs.groovy @@ -42,6 +42,7 @@ suite ("test_dup_mv_abs") { sql "insert into d_table select -4,-4,-4,'d';" sql """analyze table d_table with sync;""" + sql """alter table d_table modify column k1 set stats ('row_count'='4');""" sql """set enable_stats=false;""" qt_select_star "select * from d_table order by k1;" @@ -65,7 +66,6 @@ suite ("test_dup_mv_abs") { qt_select_group_mv_not "select sum(abs(k2)) from d_table group by k3 order by k3;" sql """set enable_stats=true;""" - sql """alter table d_table modify column k1 set stats ('row_count'='4');""" mv_rewrite_success("select k1,abs(k2) from d_table order by k1;", "k12a") mv_rewrite_success("select abs(k2) from d_table order by k1;", "k12a") diff --git a/regression-test/suites/mv_p0/test_dup_mv_bin/test_dup_mv_bin.groovy b/regression-test/suites/mv_p0/test_dup_mv_bin/test_dup_mv_bin.groovy index 4b8fa5aa6359e8..74242854cf7667 100644 --- a/regression-test/suites/mv_p0/test_dup_mv_bin/test_dup_mv_bin.groovy +++ b/regression-test/suites/mv_p0/test_dup_mv_bin/test_dup_mv_bin.groovy @@ -41,6 +41,7 @@ suite ("test_dup_mv_bin") { sql "insert into d_table select -4,-4,-4,'d';" sql "analyze table d_table with sync;" + sql """alter table d_table modify column k1 set stats ('row_count'='4');""" sql """set enable_stats=false;""" qt_select_star "select * from d_table order by k1;" @@ -63,8 +64,6 @@ suite ("test_dup_mv_bin") { mv_rewrite_fail("select group_concat(bin(k2)) from d_table group by k3;", "k12b") qt_select_group_mv_not "select group_concat(bin(k2)) from d_table group by k3 order by k3;" - sql """set enable_stats=true;""" - sql """alter table d_table modify column k1 set stats ('row_count'='4');""" mv_rewrite_success("select k1,bin(k2) from d_table order by k1;", "k12b") mv_rewrite_success("select bin(k2) from d_table order by k1;", "k12b") diff --git a/regression-test/suites/mv_p0/test_dup_mv_bitmap_hash/test_dup_mv_bitmap_hash.groovy b/regression-test/suites/mv_p0/test_dup_mv_bitmap_hash/test_dup_mv_bitmap_hash.groovy index 6530fd84cac7a8..a73540f978e31e 100644 --- a/regression-test/suites/mv_p0/test_dup_mv_bitmap_hash/test_dup_mv_bitmap_hash.groovy +++ b/regression-test/suites/mv_p0/test_dup_mv_bitmap_hash/test_dup_mv_bitmap_hash.groovy @@ -41,12 +41,12 @@ suite ("test_dup_mv_bitmap_hash") { createMV( "create materialized view k1g2bm as select k1,bitmap_union(to_bitmap(k2)) from d_table group by k1;") sql """analyze table d_table with sync;""" + sql """alter table d_table modify column k1 set stats ('row_count'='4');""" sql """set enable_stats=false;""" mv_rewrite_success("select bitmap_union_count(to_bitmap(k2)) from d_table group by k1 order by k1;", "k1g2bm") qt_select_mv "select bitmap_union_count(to_bitmap(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 bitmap_union_count(to_bitmap(k2)) from d_table group by k1 order by k1;", "k1g2bm") createMV "create materialized view k1g3bm as select k1,bitmap_union(bitmap_hash(k3)) from d_table group by k1;" @@ -61,6 +61,7 @@ suite ("test_dup_mv_bitmap_hash") { sql """set enable_stats=true;""" sql """alter table d_table modify column k1 set stats ('row_count'='4');""" sql """analyze table d_table with sync;""" + sql """alter table d_table modify column k1 set stats ('row_count'='4');""" sql """set enable_stats=false;""" mv_rewrite_success("select k1,bitmap_union_count(bitmap_hash(k3)) from d_table group by k1;", "k1g3bm") diff --git a/regression-test/suites/mv_p0/test_dup_mv_plus/test_dup_mv_plus.groovy b/regression-test/suites/mv_p0/test_dup_mv_plus/test_dup_mv_plus.groovy index ad437db464b3bb..86f06b665df2bb 100644 --- a/regression-test/suites/mv_p0/test_dup_mv_plus/test_dup_mv_plus.groovy +++ b/regression-test/suites/mv_p0/test_dup_mv_plus/test_dup_mv_plus.groovy @@ -41,6 +41,7 @@ suite ("test_dup_mv_plus") { sql "insert into d_table select -4,-4,-4,'d';" sql "analyze table d_table with sync;" + sql """alter table d_table modify column k4 set stats ('row_count'='3');""" sql """set enable_stats=false;""" qt_select_star "select * from d_table order by k1;" @@ -70,7 +71,6 @@ 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 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") diff --git a/regression-test/suites/mv_p0/test_dup_mv_year/test_dup_mv_year.groovy b/regression-test/suites/mv_p0/test_dup_mv_year/test_dup_mv_year.groovy index 18f798f8b6aac3..e82b418824101a 100644 --- a/regression-test/suites/mv_p0/test_dup_mv_year/test_dup_mv_year.groovy +++ b/regression-test/suites/mv_p0/test_dup_mv_year/test_dup_mv_year.groovy @@ -39,13 +39,13 @@ suite ("test_dup_mv_year") { createMV "create materialized view k12y as select k1,year(k2) from d_table;" sql """analyze table d_table with sync;""" + sql """alter table d_table modify column k1 set stats ('row_count'='4');""" sql """set enable_stats=false;""" mv_rewrite_success("select k1,year(k2) from d_table order by k1;", "k12y") qt_select_mv "select k1,year(k2) from d_table 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,year(k2) from d_table order by k1;", "k12y") createMV "create materialized view k13y as select k1,year(k3) from d_table;" @@ -57,6 +57,7 @@ suite ("test_dup_mv_year") { mv_rewrite_success("select year(k3) from d_table order by k1;", "k13y") qt_select_mv_sub "select year(k3) from d_table order by k1;" + sql """alter table d_table modify column k1 set stats ('row_count'='4');""" sql """set enable_stats=false;""" mv_rewrite_success("select year(k3) from d_table order by k1;", "k13y") } diff --git a/regression-test/suites/mv_p0/test_mv_mow/test_mv_mow.groovy b/regression-test/suites/mv_p0/test_mv_mow/test_mv_mow.groovy index 3fe10c2e50a33a..47b81d40794582 100644 --- a/regression-test/suites/mv_p0/test_mv_mow/test_mv_mow.groovy +++ b/regression-test/suites/mv_p0/test_mv_mow/test_mv_mow.groovy @@ -40,7 +40,8 @@ suite ("test_mv_mow") { sql "insert into u_table select 1,1,1,2;" sql "insert into u_table select 1,2,1,2;" - + sql """alter table u_table modify column k1 set stats ('row_count'='2');""" + sql """set enable_stats=false;""" mv_rewrite_success("select k1,k2+k3 from u_table order by k1;", "k123p") @@ -50,6 +51,5 @@ suite ("test_mv_mow") { qt_select_mv "select mv_k1 from `u_table` index `k123p` order by 1;" qt_select_mv "select `mv_(k2 + k3)` from `u_table` index `k123p` order by 1;" sql """set enable_stats=true;""" - sql """alter table u_table modify column k1 set stats ('row_count'='2');""" mv_rewrite_success("select k1,k2+k3 from u_table order by k1;", "k123p") } diff --git a/regression-test/suites/mv_p0/test_ndv/test_ndv.groovy b/regression-test/suites/mv_p0/test_ndv/test_ndv.groovy index 2d43785ba6fafb..2668c3ce2893aa 100644 --- a/regression-test/suites/mv_p0/test_ndv/test_ndv.groovy +++ b/regression-test/suites/mv_p0/test_ndv/test_ndv.groovy @@ -38,6 +38,7 @@ suite ("test_ndv") { sql """insert into user_tags values("2020-01-01",1,"a",2);""" sql """analyze table user_tags with sync;""" + sql """alter table user_tags modify column time_col set stats ('row_count'='3');""" sql """set enable_stats=false;""" mv_rewrite_fail("select * from user_tags order by time_col;", "user_tags_mv") @@ -50,7 +51,6 @@ suite ("test_ndv") { qt_select_mv "select user_id, approx_count_distinct(tag_id) a from user_tags group by user_id order by user_id;" sql """set enable_stats=true;""" - sql """alter table user_tags modify column time_col set stats ('row_count'='3');""" mv_rewrite_fail("select * from user_tags order by time_col;", "user_tags_mv") mv_rewrite_success("select user_id, ndv(tag_id) a from user_tags group by user_id order by user_id;", "user_tags_mv") diff --git a/regression-test/suites/mv_p0/test_nvl/test_nvl.groovy b/regression-test/suites/mv_p0/test_nvl/test_nvl.groovy index 12f5765666ef28..74db56ffef9678 100644 --- a/regression-test/suites/mv_p0/test_nvl/test_nvl.groovy +++ b/regression-test/suites/mv_p0/test_nvl/test_nvl.groovy @@ -42,6 +42,7 @@ suite ("test_nvl") { sql """insert into dwd(id) values(2);""" sql """analyze table dwd with sync;""" + sql """alter table dwd modify column id set stats ('row_count'='2');""" sql """set enable_stats=false;""" mv_rewrite_success("select nvl(id,0) from dwd order by 1;", "dwd_mv") diff --git a/regression-test/suites/mv_p0/test_o2/test_o2.groovy b/regression-test/suites/mv_p0/test_o2/test_o2.groovy index 34d31a08cfae7b..0720647801249d 100644 --- a/regression-test/suites/mv_p0/test_o2/test_o2.groovy +++ b/regression-test/suites/mv_p0/test_o2/test_o2.groovy @@ -53,6 +53,7 @@ suite ("test_o2") { sql """insert into o2_order_events values ("2023-08-16 22:27:00 ","ax",1,"asd",2,1,1,1,1,1,1,1);""" sql """analyze table o2_order_events with sync;""" + sql """alter table o2_order_events modify column ts set stats ('row_count'='2');""" sql """set enable_stats=false;""" mv_rewrite_success("select ts,metric_name,platform,sum(count_value) from o2_order_events group by ts,metric_name,platform;", @@ -60,7 +61,6 @@ suite ("test_o2") { qt_select_mv "select ts,metric_name,platform,sum(count_value) from o2_order_events group by ts,metric_name,platform;" sql """set enable_stats=true;""" - sql """alter table o2_order_events modify column ts set stats ('row_count'='2');""" mv_rewrite_success("select ts,metric_name,platform,sum(count_value) from o2_order_events group by ts,metric_name,platform;", "o2_order_events_mv") } diff --git a/regression-test/suites/mv_p0/test_substr/test_substr.groovy b/regression-test/suites/mv_p0/test_substr/test_substr.groovy index 7d6ae82634fd8c..8012dbdaf4a7fc 100644 --- a/regression-test/suites/mv_p0/test_substr/test_substr.groovy +++ b/regression-test/suites/mv_p0/test_substr/test_substr.groovy @@ -49,6 +49,7 @@ suite ("test_substr") { sql """insert into dwd(id) values(2);""" sql """analyze table dwd with sync;""" + sql """alter table dwd modify column id set stats ('row_count'='2');""" sql """set enable_stats=false;""" mv_rewrite_success("SELECT substr(created_at,1,10) as statistic_date, max(dt) as dt FROM dwd group by substr(created_at,1,10);", @@ -56,7 +57,6 @@ suite ("test_substr") { qt_select_mv "SELECT substr(created_at,1,10) as statistic_date, max(dt) as dt FROM dwd group by substr(created_at,1,10);" sql """set enable_stats=true;""" - sql """alter table dwd modify column id set stats ('row_count'='2');""" mv_rewrite_success("SELECT substr(created_at,1,10) as statistic_date, max(dt) as dt FROM dwd group by substr(created_at,1,10);", "dwd_mv") } diff --git a/regression-test/suites/mv_p0/test_tbl_name/test_tbl_name.groovy b/regression-test/suites/mv_p0/test_tbl_name/test_tbl_name.groovy index bbfa8ea6a54d17..062cbf68b078f9 100644 --- a/regression-test/suites/mv_p0/test_tbl_name/test_tbl_name.groovy +++ b/regression-test/suites/mv_p0/test_tbl_name/test_tbl_name.groovy @@ -40,6 +40,7 @@ suite ("test_tbl_name") { sql """insert into functionality_olap values(143,'mv',18);""" sql """analyze table functionality_olap with sync;""" + sql """alter table functionality_olap modify column id set stats ('row_count'='2');""" sql """set enable_stats=false;""" mv_rewrite_success("""select @@ -66,7 +67,6 @@ suite ("test_tbl_name") { group by id order by 1,2; """ sql """set enable_stats=true;""" - sql """alter table functionality_olap modify column id set stats ('row_count'='2');""" mv_rewrite_success("""select functionality_olap.id as id, sum(functionality_olap.score) as score_max diff --git a/regression-test/suites/mv_p0/test_upper_alias/test_upper_alias.groovy b/regression-test/suites/mv_p0/test_upper_alias/test_upper_alias.groovy index 69264d838e4d24..55aa1d6c024066 100644 --- a/regression-test/suites/mv_p0/test_upper_alias/test_upper_alias.groovy +++ b/regression-test/suites/mv_p0/test_upper_alias/test_upper_alias.groovy @@ -50,6 +50,8 @@ suite ("test_upper_alias") { """) sql "analyze table test_0401 with sync;" + sql """alter table test_0401 modify column d_b set stats ('row_count'='3');""" + sql """set enable_stats=false;""" mv_rewrite_success("SELECT upper(d_b) AS d_b FROM test_0401 GROUP BY upper(d_b) order by 1;", "test_0401_mv"); @@ -62,7 +64,6 @@ suite ("test_upper_alias") { qt_select_mv "SELECT d_a AS d_b FROM test_0401 order by 1;" sql """set enable_stats=true;""" - sql """alter table test_0401 modify column d_b set stats ('row_count'='3');""" mv_rewrite_any_success("SELECT upper(d_b) AS d_b FROM test_0401 GROUP BY upper(d_b) order by 1;", ["test_0401_mv", "test_0401_mv2"]) diff --git a/regression-test/suites/mv_p0/ut/testAggQueryOnAggMV10/testAggQueryOnAggMV10.groovy b/regression-test/suites/mv_p0/ut/testAggQueryOnAggMV10/testAggQueryOnAggMV10.groovy index 739dde33372cb6..8747f7641a91ca 100644 --- a/regression-test/suites/mv_p0/ut/testAggQueryOnAggMV10/testAggQueryOnAggMV10.groovy +++ b/regression-test/suites/mv_p0/ut/testAggQueryOnAggMV10/testAggQueryOnAggMV10.groovy @@ -41,6 +41,7 @@ suite ("testAggQueryOnAggMV10") { sql """insert into emps values("2020-01-01",1,"a",1,1,1);""" sql "analyze table emps with sync;" + sql """alter table emps modify column time_col set stats ('row_count'='4');""" sql """set enable_stats=false;""" mv_rewrite_fail("select * from emps order by empid;", "emps_mv") @@ -51,7 +52,6 @@ suite ("testAggQueryOnAggMV10") { qt_select_mv "select deptno, commission, sum(salary) + 1 from emps group by rollup (deptno, commission) order by 1,2;" sql """set enable_stats=true;""" - 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, commission, sum(salary) + 1 from emps group by rollup (deptno, commission);", diff --git a/regression-test/suites/mv_p0/ut/testAggQueryOnAggMV11/testAggQueryOnAggMV11.groovy b/regression-test/suites/mv_p0/ut/testAggQueryOnAggMV11/testAggQueryOnAggMV11.groovy index a4d69136bc03ca..dcd4f05f76cd9a 100644 --- a/regression-test/suites/mv_p0/ut/testAggQueryOnAggMV11/testAggQueryOnAggMV11.groovy +++ b/regression-test/suites/mv_p0/ut/testAggQueryOnAggMV11/testAggQueryOnAggMV11.groovy @@ -41,6 +41,7 @@ suite ("testAggQueryOnAggMV11") { sql """insert into emps values("2020-01-01",1,"a",1,1,1);""" sql "analyze table emps with sync;" + sql """alter table emps modify column time_col set stats ('row_count'='4');""" sql """set enable_stats=false;""" mv_rewrite_fail("select * from emps order by empid;", "emps_mv") @@ -50,7 +51,7 @@ suite ("testAggQueryOnAggMV11") { qt_select_mv "select deptno, count(salary) + count(1) from emps group by deptno order by 1;" sql """set enable_stats=true;""" - 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_fail("select deptno, count(salary) + count(1) from emps group by deptno;", "emps_mv") diff --git a/regression-test/suites/mv_p0/ut/testAggQueryOnAggMV2/testAggQueryOnAggMV2.groovy b/regression-test/suites/mv_p0/ut/testAggQueryOnAggMV2/testAggQueryOnAggMV2.groovy index 5cf7d257fe8b73..f2aadc63e17b9c 100644 --- a/regression-test/suites/mv_p0/ut/testAggQueryOnAggMV2/testAggQueryOnAggMV2.groovy +++ b/regression-test/suites/mv_p0/ut/testAggQueryOnAggMV2/testAggQueryOnAggMV2.groovy @@ -43,6 +43,7 @@ suite ("testAggQueryOnAggMV2") { createMV("create materialized view emps_mv as select deptno, sum(salary) from emps group by deptno ;") sql "analyze table emps with sync;" + sql """alter table emps modify column time_col set stats ('row_count'='3');""" sql """set enable_stats=false;""" mv_rewrite_fail("select * from emps order by empid;", "emps_mv") @@ -53,7 +54,6 @@ suite ("testAggQueryOnAggMV2") { qt_select_mv "select * from (select deptno, sum(salary) as sum_salary from emps group by deptno) a where (sum_salary * 2) > 3 order by deptno ;" sql """set enable_stats=true;""" - sql """alter table emps modify column time_col set stats ('row_count'='3');""" mv_rewrite_fail("select * from emps order by empid;", "emps_mv") mv_rewrite_success("select * from (select deptno, sum(salary) as sum_salary from emps group by deptno) a where (sum_salary * 2) > 3 order by deptno ;", diff --git a/regression-test/suites/mv_p0/ut/testAggQueryOnAggMV3/testAggQueryOnAggMV3.groovy b/regression-test/suites/mv_p0/ut/testAggQueryOnAggMV3/testAggQueryOnAggMV3.groovy index d2f61e04762b2f..bf46b5b0af7101 100644 --- a/regression-test/suites/mv_p0/ut/testAggQueryOnAggMV3/testAggQueryOnAggMV3.groovy +++ b/regression-test/suites/mv_p0/ut/testAggQueryOnAggMV3/testAggQueryOnAggMV3.groovy @@ -41,6 +41,7 @@ suite ("testAggQueryOnAggMV3") { createMV("create materialized view emps_mv as select deptno, commission, sum(salary) from emps group by deptno, commission;") sql "analyze table emps with sync;" + sql """alter table emps modify column time_col set stats ('row_count'='4');""" sql """set enable_stats=false;""" mv_rewrite_fail("select * from emps order by empid;", "emps_mv") @@ -55,7 +56,6 @@ suite ("testAggQueryOnAggMV3") { qt_select_mv "select commission, sum(salary) from emps where commission = 100 group by commission order by commission;" sql """set enable_stats=true;""" - 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 commission, sum(salary) from emps where deptno > 0 and commission * (deptno + commission) = 100 group by commission order by commission;", diff --git a/regression-test/suites/mv_p0/ut/testAggQuqeryOnAggMV5/testAggQuqeryOnAggMV5.groovy b/regression-test/suites/mv_p0/ut/testAggQuqeryOnAggMV5/testAggQuqeryOnAggMV5.groovy index 1f14728e3b7b2c..1e2b01dbc61abe 100644 --- a/regression-test/suites/mv_p0/ut/testAggQuqeryOnAggMV5/testAggQuqeryOnAggMV5.groovy +++ b/regression-test/suites/mv_p0/ut/testAggQuqeryOnAggMV5/testAggQuqeryOnAggMV5.groovy @@ -41,6 +41,7 @@ suite ("testAggQuqeryOnAggMV5") { sql """insert into emps values("2020-01-01",1,"a",1,1,1);""" sql """analyze table emps with sync;""" + sql """alter table emps modify column time_col set stats ('row_count'='4');""" sql """set enable_stats=false;""" mv_rewrite_fail("select * from emps order by empid;", "emps_mv") @@ -51,7 +52,7 @@ suite ("testAggQuqeryOnAggMV5") { qt_select_mv "select * from (select deptno, sum(salary) as sum_salary from emps group by deptno) a where sum_salary>10 order by 1;" sql """set enable_stats=true;""" - 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 * from (select deptno, sum(salary) as sum_salary from emps group by deptno) a where sum_salary>0;", diff --git a/regression-test/suites/mv_p0/ut/testAggQuqeryOnAggMV6/testAggQuqeryOnAggMV6.groovy b/regression-test/suites/mv_p0/ut/testAggQuqeryOnAggMV6/testAggQuqeryOnAggMV6.groovy index 4cafeaa185f4a3..cdc3178b63ad2a 100644 --- a/regression-test/suites/mv_p0/ut/testAggQuqeryOnAggMV6/testAggQuqeryOnAggMV6.groovy +++ b/regression-test/suites/mv_p0/ut/testAggQuqeryOnAggMV6/testAggQuqeryOnAggMV6.groovy @@ -41,6 +41,8 @@ suite ("testAggQuqeryOnAggMV6") { sql """insert into emps values("2020-01-01",1,"a",1,1,1);""" sql """analyze table emps with sync;""" + sql """alter table emps modify column time_col set stats ('row_count'='4');""" + sql """set enable_stats=false;""" mv_rewrite_fail("select * from emps order by empid;", "emps_mv") @@ -51,7 +53,6 @@ suite ("testAggQuqeryOnAggMV6") { qt_select_mv "select * from (select deptno, sum(salary) as sum_salary from emps where deptno>=20 group by deptno) a where sum_salary>10 order by 1;" sql """set enable_stats=true;""" - 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 * from (select deptno, sum(salary) as sum_salary from emps where deptno>=0 group by deptno) a where sum_salary>10;", diff --git a/regression-test/suites/mv_p0/ut/testAggQuqeryOnAggMV7/testAggQuqeryOnAggMV7.groovy b/regression-test/suites/mv_p0/ut/testAggQuqeryOnAggMV7/testAggQuqeryOnAggMV7.groovy index d43b5796e6d7f9..82e2c878956ec7 100644 --- a/regression-test/suites/mv_p0/ut/testAggQuqeryOnAggMV7/testAggQuqeryOnAggMV7.groovy +++ b/regression-test/suites/mv_p0/ut/testAggQuqeryOnAggMV7/testAggQuqeryOnAggMV7.groovy @@ -41,6 +41,8 @@ suite ("testAggQuqeryOnAggMV7") { sql """insert into emps values("2020-01-01",1,"a",1,1,1);""" sql """analyze table emps with sync;""" + 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');""" sql """set enable_stats=false;""" mv_rewrite_fail("select * from emps order by empid;", "emps_mv") @@ -50,8 +52,7 @@ suite ("testAggQuqeryOnAggMV7") { qt_select_mv "select deptno, sum(salary) from emps where deptno>=20 group by deptno order by 1;" 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") diff --git a/regression-test/suites/mv_p0/ut/testAggTableCountDistinctInBitmapType/testAggTableCountDistinctInBitmapType.groovy b/regression-test/suites/mv_p0/ut/testAggTableCountDistinctInBitmapType/testAggTableCountDistinctInBitmapType.groovy index 26f1fdb0219a2d..2af8c74566e98e 100644 --- a/regression-test/suites/mv_p0/ut/testAggTableCountDistinctInBitmapType/testAggTableCountDistinctInBitmapType.groovy +++ b/regression-test/suites/mv_p0/ut/testAggTableCountDistinctInBitmapType/testAggTableCountDistinctInBitmapType.groovy @@ -30,6 +30,7 @@ suite ("testAggTableCountDistinctInBitmapType") { sql "analyze table test_tb with sync;" + sql """alter table test_tb modify column k1 set stats ('row_count'='3');""" sql """set enable_stats=false;""" qt_select_star "select * from test_tb order by 1;" @@ -42,7 +43,7 @@ suite ("testAggTableCountDistinctInBitmapType") { qt_select_mv "select k1, count(distinct v1) from test_tb group by k1 order by k1;" sql """set enable_stats=true;""" - sql """alter table test_tb modify column k1 set stats ('row_count'='3');""" + explain { sql("select k1, count(distinct v1) from test_tb group by k1;") contains "bitmap_union_count" diff --git a/regression-test/suites/mv_p0/ut/testAggregateMVCalcAggFunctionQuery/testAggregateMVCalcAggFunctionQuery.groovy b/regression-test/suites/mv_p0/ut/testAggregateMVCalcAggFunctionQuery/testAggregateMVCalcAggFunctionQuery.groovy index 6dc78784956d32..9fdee877cd69e1 100644 --- a/regression-test/suites/mv_p0/ut/testAggregateMVCalcAggFunctionQuery/testAggregateMVCalcAggFunctionQuery.groovy +++ b/regression-test/suites/mv_p0/ut/testAggregateMVCalcAggFunctionQuery/testAggregateMVCalcAggFunctionQuery.groovy @@ -41,6 +41,7 @@ suite ("testAggregateMVCalcAggFunctionQuery") { sql """insert into emps values("2020-01-01",1,"a",1,1,1);""" sql "analyze table emps with sync;" + sql """alter table emps modify column time_col set stats ('row_count'='4');""" sql """set enable_stats=false;""" mv_rewrite_fail("select * from emps order by empid;", "emps_mv") @@ -50,7 +51,6 @@ suite ("testAggregateMVCalcAggFunctionQuery") { qt_select_mv "select deptno, sum(salary + 1) from emps where deptno > 10 group by deptno order by deptno;" sql """set enable_stats=true;""" - 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_fail("select deptno, sum(salary + 1) from emps where deptno > 10 group by deptno;", "emps_mv") diff --git a/regression-test/suites/mv_p0/ut/testBitmapUnionInQuery/testBitmapUnionInQuery.groovy b/regression-test/suites/mv_p0/ut/testBitmapUnionInQuery/testBitmapUnionInQuery.groovy index c1287bfa94bcc4..ab6632ca48765c 100644 --- a/regression-test/suites/mv_p0/ut/testBitmapUnionInQuery/testBitmapUnionInQuery.groovy +++ b/regression-test/suites/mv_p0/ut/testBitmapUnionInQuery/testBitmapUnionInQuery.groovy @@ -37,6 +37,7 @@ suite ("testBitmapUnionInQuery") { sql """insert into user_tags values("2020-01-01",1,"a",2);""" sql "analyze table user_tags with sync;" + sql """alter table user_tags modify column time_col set stats ('row_count'='3');""" sql """set enable_stats=false;""" mv_rewrite_fail("select * from user_tags order by time_col;", "user_tags_mv") @@ -51,7 +52,7 @@ suite ("testBitmapUnionInQuery") { qt_select_mv "select user_id, bitmap_count(bitmap_union(to_bitmap(tag_id))) a from user_tags group by user_id having a>1 order by a;" sql """set enable_stats=true;""" - sql """alter table user_tags modify column time_col set stats ('row_count'='3');""" + mv_rewrite_fail("select * from user_tags order by time_col;", "user_tags_mv") mv_rewrite_success("select user_id, bitmap_union_count(to_bitmap(tag_id)) a from user_tags group by user_id having a>1 order by a;", diff --git a/regression-test/suites/mv_p0/ut/testCountDistinctToBitmap/testCountDistinctToBitmap.groovy b/regression-test/suites/mv_p0/ut/testCountDistinctToBitmap/testCountDistinctToBitmap.groovy index 5cc05db62be1a7..4e1de1eedee3e1 100644 --- a/regression-test/suites/mv_p0/ut/testCountDistinctToBitmap/testCountDistinctToBitmap.groovy +++ b/regression-test/suites/mv_p0/ut/testCountDistinctToBitmap/testCountDistinctToBitmap.groovy @@ -37,6 +37,7 @@ suite ("testCountDistinctToBitmap") { sql """insert into user_tags values("2020-01-01",1,"a",2);""" sql "analyze table user_tags with sync;" + sql """alter table user_tags modify column time_col set stats ('row_count'='3');""" sql """set enable_stats=false;""" mv_rewrite_fail("select * from user_tags order by time_col;", "user_tags_mv") diff --git a/regression-test/suites/mv_p0/ut/testIncorrectMVRewriteInSubquery/testIncorrectMVRewriteInSubquery.groovy b/regression-test/suites/mv_p0/ut/testIncorrectMVRewriteInSubquery/testIncorrectMVRewriteInSubquery.groovy index 698490f0943e88..4de20757ef8fc8 100644 --- a/regression-test/suites/mv_p0/ut/testIncorrectMVRewriteInSubquery/testIncorrectMVRewriteInSubquery.groovy +++ b/regression-test/suites/mv_p0/ut/testIncorrectMVRewriteInSubquery/testIncorrectMVRewriteInSubquery.groovy @@ -36,6 +36,7 @@ suite ("testIncorrectMVRewriteInSubquery") { sql """insert into user_tags values("2020-01-01",1,"a",2);""" sql "analyze table user_tags with sync;" + sql """alter table user_tags modify column time_col set stats ('row_count'='3');""" sql """set enable_stats=false;""" mv_rewrite_fail("select * from user_tags order by time_col;", "user_tags_mv") @@ -47,7 +48,7 @@ suite ("testIncorrectMVRewriteInSubquery") { qt_select_mv "select user_id, bitmap_union(to_bitmap(tag_id)) from user_tags where user_name in (select user_name from user_tags group by user_name having bitmap_union_count(to_bitmap(tag_id)) >1 ) group by user_id order by user_id;" sql """set enable_stats=true;""" - sql """alter table user_tags modify column time_col set stats ('row_count'='3');""" + mv_rewrite_fail("select * from user_tags order by time_col;", "user_tags_mv") mv_rewrite_fail("select user_id, bitmap_union(to_bitmap(tag_id)) from user_tags where user_name in (select user_name from user_tags group by user_name having bitmap_union_count(to_bitmap(tag_id)) >1 ) group by user_id order by user_id;", diff --git a/regression-test/suites/mv_p0/ut/testIncorrectRewriteCountDistinct/testIncorrectRewriteCountDistinct.groovy b/regression-test/suites/mv_p0/ut/testIncorrectRewriteCountDistinct/testIncorrectRewriteCountDistinct.groovy index 45230c5b5587d8..dfd212a7fad631 100644 --- a/regression-test/suites/mv_p0/ut/testIncorrectRewriteCountDistinct/testIncorrectRewriteCountDistinct.groovy +++ b/regression-test/suites/mv_p0/ut/testIncorrectRewriteCountDistinct/testIncorrectRewriteCountDistinct.groovy @@ -36,6 +36,7 @@ suite ("testIncorrectRewriteCountDistinct") { sql """insert into user_tags values("2020-01-01",1,"a",2);""" sql "analyze table user_tags with sync;" + sql """alter table user_tags modify column time_col set stats ('row_count'='3');""" sql """set enable_stats=false;""" mv_rewrite_fail("select * from user_tags order by time_col;", "user_tags_mv") @@ -45,7 +46,7 @@ suite ("testIncorrectRewriteCountDistinct") { qt_select_mv "select user_name, count(distinct tag_id) from user_tags group by user_name order by user_name;" sql """set enable_stats=true;""" - sql """alter table user_tags modify column time_col set stats ('row_count'='3');""" + mv_rewrite_fail("select * from user_tags order by time_col;", "user_tags_mv") mv_rewrite_fail("select user_name, count(distinct tag_id) from user_tags group by user_name;", "user_tags_mv") diff --git a/regression-test/suites/mv_p0/ut/testJoinOnLeftProjectToJoin/testJoinOnLeftProjectToJoin.groovy b/regression-test/suites/mv_p0/ut/testJoinOnLeftProjectToJoin/testJoinOnLeftProjectToJoin.groovy index 8f41fc1ffb5e74..6f6097438421d7 100644 --- a/regression-test/suites/mv_p0/ut/testJoinOnLeftProjectToJoin/testJoinOnLeftProjectToJoin.groovy +++ b/regression-test/suites/mv_p0/ut/testJoinOnLeftProjectToJoin/testJoinOnLeftProjectToJoin.groovy @@ -53,6 +53,8 @@ suite ("testJoinOnLeftProjectToJoin") { createMV("create materialized view depts_mv as select deptno, max(cost) from depts group by deptno;") sql "analyze table emps with sync;" + sql """alter table emps modify column time_col set stats ('row_count'='3');""" + sql """set enable_stats=false;""" mv_rewrite_all_success("select * from (select deptno , sum(salary) from emps group by deptno) A join (select deptno, max(cost) from depts group by deptno ) B on A.deptno = B.deptno;", @@ -61,7 +63,6 @@ suite ("testJoinOnLeftProjectToJoin") { qt_select_mv "select * from (select deptno , sum(salary) from emps group by deptno) A join (select deptno, max(cost) from depts group by deptno ) B on A.deptno = B.deptno order by A.deptno;" sql """set enable_stats=true;""" - sql """alter table emps modify column time_col set stats ('row_count'='3');""" mv_rewrite_all_success("select * from (select deptno , sum(salary) from emps group by deptno) A join (select deptno, max(cost) from depts group by deptno ) B on A.deptno = B.deptno;", ["emps_mv", "depts_mv"]) } diff --git a/regression-test/suites/mv_p0/ut/testNDVToHll/testNDVToHll.groovy b/regression-test/suites/mv_p0/ut/testNDVToHll/testNDVToHll.groovy index c77f58609ca0cb..769d483544ca0b 100644 --- a/regression-test/suites/mv_p0/ut/testNDVToHll/testNDVToHll.groovy +++ b/regression-test/suites/mv_p0/ut/testNDVToHll/testNDVToHll.groovy @@ -38,6 +38,7 @@ suite ("testNDVToHll") { sql """insert into user_tags values("2020-01-01",1,"a",2);""" sql "analyze table user_tags with sync;" + sql """alter table user_tags modify column time_col set stats ('row_count'='3');""" sql """set enable_stats=false;""" mv_rewrite_fail("select * from user_tags order by time_col;", "user_tags_mv") @@ -50,7 +51,7 @@ suite ("testNDVToHll") { qt_select_mv "select user_id, approx_count_distinct(tag_id) a from user_tags group by user_id order by user_id;" sql """set enable_stats=true;""" - sql """alter table user_tags modify column time_col set stats ('row_count'='3');""" + mv_rewrite_fail("select * from user_tags order by time_col;", "user_tags_mv") mv_rewrite_success("select user_id, ndv(tag_id) a from user_tags group by user_id order by user_id;", "user_tags_mv") diff --git a/regression-test/suites/mv_p0/ut/testOrderByQueryOnProjectView/testOrderByQueryOnProjectView.groovy b/regression-test/suites/mv_p0/ut/testOrderByQueryOnProjectView/testOrderByQueryOnProjectView.groovy index 41cf480e880cd0..b5c11b3fbdbafe 100644 --- a/regression-test/suites/mv_p0/ut/testOrderByQueryOnProjectView/testOrderByQueryOnProjectView.groovy +++ b/regression-test/suites/mv_p0/ut/testOrderByQueryOnProjectView/testOrderByQueryOnProjectView.groovy @@ -40,6 +40,7 @@ suite ("testOrderByQueryOnProjectView") { sql """insert into emps values("2020-01-01",1,"a",1,1,1);""" sql "analyze table emps with sync;" + sql """alter table emps modify column time_col set stats ('row_count'='4');""" sql """set enable_stats=false;""" mv_rewrite_fail("select * from emps order by empid;", "emps_mv") @@ -48,8 +49,6 @@ suite ("testOrderByQueryOnProjectView") { mv_rewrite_success("select empid from emps where deptno > 0 order by deptno;", "emps_mv") qt_select_mv "select empid from emps order by deptno;" - sql """set enable_stats=true;""" - 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 empid from emps where deptno > 0 order by deptno;", "emps_mv") diff --git a/regression-test/suites/mv_p0/ut/testProjectionMV1/testProjectionMV1.groovy b/regression-test/suites/mv_p0/ut/testProjectionMV1/testProjectionMV1.groovy index d578cbddba945d..dcc8245a45f922 100644 --- a/regression-test/suites/mv_p0/ut/testProjectionMV1/testProjectionMV1.groovy +++ b/regression-test/suites/mv_p0/ut/testProjectionMV1/testProjectionMV1.groovy @@ -44,6 +44,7 @@ suite ("testProjectionMV1") { sql """insert into emps values("2020-01-01",1,"a",1,1,1);""" sql "analyze table emps with sync;" + sql """alter table emps modify column time_col set stats ('row_count'='3');""" sql """set enable_stats=false;""" mv_rewrite_fail("select * from emps order by empid;", "emps_mv") @@ -61,7 +62,7 @@ suite ("testProjectionMV1") { qt_select_mv "select deptno, sum(empid) from emps group by deptno order by deptno;" sql """set enable_stats=true;""" - sql """alter table emps modify column time_col set stats ('row_count'='3');""" + mv_rewrite_fail("select * from emps order by empid;", "emps_mv") mv_rewrite_success("select empid, deptno from emps where deptno > 0 order by empid;", "emps_mv") diff --git a/regression-test/suites/mv_p0/ut/testProjectionMV2/testProjectionMV2.groovy b/regression-test/suites/mv_p0/ut/testProjectionMV2/testProjectionMV2.groovy index b663bfcd2b1738..8d65df35835086 100644 --- a/regression-test/suites/mv_p0/ut/testProjectionMV2/testProjectionMV2.groovy +++ b/regression-test/suites/mv_p0/ut/testProjectionMV2/testProjectionMV2.groovy @@ -39,6 +39,7 @@ suite ("testProjectionMV2") { sql """insert into emps values("2020-01-01",1,"a",1,1,1);""" sql "analyze table emps with sync;" + sql """alter table emps modify column time_col set stats ('row_count'='3');""" sql """set enable_stats=false;""" mv_rewrite_fail("select * from emps order by empid;", "emps_mv") @@ -51,7 +52,7 @@ suite ("testProjectionMV2") { qt_select_base "select name from emps where deptno -1 = 0 order by empid;" sql """set enable_stats=true;""" - sql """alter table emps modify column time_col set stats ('row_count'='3');""" + mv_rewrite_fail("select * from emps order by empid;", "emps_mv") mv_rewrite_success("select empid + 1 from emps where deptno = 1 order by empid;", "emps_mv") diff --git a/regression-test/suites/mv_p0/ut/testProjectionMV3/testProjectionMV3.groovy b/regression-test/suites/mv_p0/ut/testProjectionMV3/testProjectionMV3.groovy index 378ec80d6cfd72..5c24070d9cc935 100644 --- a/regression-test/suites/mv_p0/ut/testProjectionMV3/testProjectionMV3.groovy +++ b/regression-test/suites/mv_p0/ut/testProjectionMV3/testProjectionMV3.groovy @@ -41,6 +41,7 @@ suite ("testProjectionMV3") { sql """insert into emps values("2020-01-01",1,"a",1,1,1);""" sql """analyze table emps with sync;""" + sql """alter table emps modify column time_col set stats ('row_count'='3');""" sql """set enable_stats=false;""" mv_rewrite_fail("select * from emps order by empid;", "emps_mv") @@ -53,7 +54,7 @@ suite ("testProjectionMV3") { qt_select_mv2 "select name from emps where deptno = 1 order by empid;" sql """set enable_stats=true;""" - sql """alter table emps modify column time_col set stats ('row_count'='3');""" + mv_rewrite_fail("select * from emps order by empid;", "emps_mv") mv_rewrite_success("select empid + 1, name from emps where deptno = 1 order by empid;", "emps_mv") diff --git a/regression-test/suites/mv_p0/ut/testProjectionMV4/testProjectionMV4.groovy b/regression-test/suites/mv_p0/ut/testProjectionMV4/testProjectionMV4.groovy index 37a57f80d03cae..370f21b3d73ff5 100644 --- a/regression-test/suites/mv_p0/ut/testProjectionMV4/testProjectionMV4.groovy +++ b/regression-test/suites/mv_p0/ut/testProjectionMV4/testProjectionMV4.groovy @@ -41,6 +41,7 @@ suite ("testProjectionMV4") { sql """insert into emps values("2020-01-01",1,"a",1,1,1);""" sql "analyze table emps with sync;" + sql """alter table emps modify column time_col set stats ('row_count'='3');""" sql """set enable_stats=false;""" mv_rewrite_fail("select * from emps order by empid;", "emps_mv") @@ -52,7 +53,7 @@ suite ("testProjectionMV4") { qt_select_base "select empid from emps where deptno > 1 and empid > 1 order by empid;" sql """set enable_stats=true;""" - sql """alter table emps modify column time_col set stats ('row_count'='3');""" + mv_rewrite_fail("select * from emps order by empid;", "emps_mv") mv_rewrite_fail("select empid from emps where deptno > 1 and empid > 1 order by empid;", "emps_mv") diff --git a/regression-test/suites/mv_p0/ut/testSingleMVMultiUsage/testSingleMVMultiUsage.groovy b/regression-test/suites/mv_p0/ut/testSingleMVMultiUsage/testSingleMVMultiUsage.groovy index 73ddb21109bb91..5da7c15b186767 100644 --- a/regression-test/suites/mv_p0/ut/testSingleMVMultiUsage/testSingleMVMultiUsage.groovy +++ b/regression-test/suites/mv_p0/ut/testSingleMVMultiUsage/testSingleMVMultiUsage.groovy @@ -40,6 +40,7 @@ suite ("testSingleMVMultiUsage") { sql """insert into emps values("2020-01-01",1,"a",1,1,1);""" sql "analyze table emps with sync;" + sql """alter table emps modify column time_col set stats ('row_count'='4');""" sql """set enable_stats=false;""" mv_rewrite_fail("select * from emps order by empid;", "emps_mv") @@ -52,7 +53,6 @@ suite ("testSingleMVMultiUsage") { } qt_select_mv "select * from (select deptno, empid from emps where deptno>100) A join (select deptno, empid from emps where deptno >200) B using (deptno) order by 1;" sql """set enable_stats=true;""" - sql """alter table emps modify column time_col set stats ('row_count'='4');""" mv_rewrite_fail("select * from emps order by empid;", "emps_mv") explain { diff --git a/regression-test/suites/mv_p0/ut/testSubQuery/testSubQuery.groovy b/regression-test/suites/mv_p0/ut/testSubQuery/testSubQuery.groovy index cd134a5d48ea40..58100561862f83 100644 --- a/regression-test/suites/mv_p0/ut/testSubQuery/testSubQuery.groovy +++ b/regression-test/suites/mv_p0/ut/testSubQuery/testSubQuery.groovy @@ -43,6 +43,7 @@ suite ("testSubQuery") { sql """insert into emps values("2020-01-01",1,"a",1,1,1);""" sql "analyze table emps with sync;" + sql """alter table emps modify column time_col set stats ('row_count'='4');""" sql """set enable_stats=false;""" mv_rewrite_fail("select * from emps order by empid;", "emps_mv") @@ -51,6 +52,6 @@ suite ("testSubQuery") { qt_select_mv "select empid, deptno, salary from emps e1 where empid = (select max(empid) from emps where deptno = e1.deptno) order by deptno;" sql """set enable_stats=true;""" - sql """alter table emps modify column time_col set stats ('row_count'='4');""" + mv_rewrite_fail("select * from emps order by empid;", "emps_mv") } diff --git a/regression-test/suites/nereids_syntax_p0/mv/newMv/case_ignore.groovy b/regression-test/suites/nereids_syntax_p0/mv/newMv/case_ignore.groovy index e2f334566e9c24..bba8522d282531 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/newMv/case_ignore.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/newMv/case_ignore.groovy @@ -45,6 +45,8 @@ suite ("case_ignore") { sql "SET enable_fallback_to_original_planner=false" sql "analyze table case_ignore with sync;" + sql """alter table case_ignore modify column k1 set stats ('row_count'='4');""" + sql """set enable_stats=false;""" qt_select_star "select * from case_ignore order by k1;" @@ -56,7 +58,6 @@ suite ("case_ignore") { order_qt_select_mv "select K1,abs(K2) from case_ignore order by K1;" sql """set enable_stats=true;""" - sql """alter table case_ignore modify column k1 set stats ('row_count'='4');""" mv_rewrite_success("select k1,abs(k2) from case_ignore order by k1;", "k12a") mv_rewrite_success("select K1,abs(K2) from case_ignore order by K1;", "k12a") diff --git a/regression-test/suites/nereids_syntax_p0/mv/newMv/dup_gb_mv_abs.groovy b/regression-test/suites/nereids_syntax_p0/mv/newMv/dup_gb_mv_abs.groovy index 3537777d312c58..33e0a76df5588c 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/newMv/dup_gb_mv_abs.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/newMv/dup_gb_mv_abs.groovy @@ -45,6 +45,8 @@ suite ("dup_gb_mv_abs") { sql "SET enable_fallback_to_original_planner=false" sql "analyze table dup_gb_mv_abs with sync;" + sql """alter table dup_gb_mv_abs modify column k1 set stats ('row_count'='4');""" + sql """set enable_stats=false;""" @@ -57,7 +59,6 @@ suite ("dup_gb_mv_abs") { order_qt_select_mv_sub "select sum(abs(k2)) from dup_gb_mv_abs group by k1 order by k1;" sql """set enable_stats=true;""" - sql """alter table dup_gb_mv_abs modify column k1 set stats ('row_count'='4');""" mv_rewrite_success("select k1,sum(abs(k2)) from dup_gb_mv_abs group by k1;", "k12sa") mv_rewrite_success("select sum(abs(k2)) from dup_gb_mv_abs group by k1;", "k12sa") diff --git a/regression-test/suites/nereids_syntax_p0/mv/newMv/dup_gb_mv_plus.groovy b/regression-test/suites/nereids_syntax_p0/mv/newMv/dup_gb_mv_plus.groovy index 2e6e9c6b627850..bb1bc538b45fb2 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/newMv/dup_gb_mv_plus.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/newMv/dup_gb_mv_plus.groovy @@ -45,6 +45,8 @@ suite ("dup_gb_mv_plus") { sql "SET enable_fallback_to_original_planner=false" sql "analyze table dup_gb_mv_plus with sync;" + sql """alter table dup_gb_mv_plus modify column k1 set stats ('row_count'='4');""" + sql """set enable_stats=false;""" @@ -57,7 +59,6 @@ suite ("dup_gb_mv_plus") { order_qt_select_mv_sub "select sum(k2+1) from dup_gb_mv_plus group by k1 order by k1;" sql """set enable_stats=true;""" - sql """alter table dup_gb_mv_plus modify column k1 set stats ('row_count'='4');""" mv_rewrite_success("select k1,sum(k2+1) from dup_gb_mv_plus group by k1;", "k12sp") mv_rewrite_success("select sum(k2+1) from dup_gb_mv_plus group by k1;", "k12sp") diff --git a/regression-test/suites/nereids_syntax_p0/mv/newMv/dup_mv_abs.groovy b/regression-test/suites/nereids_syntax_p0/mv/newMv/dup_mv_abs.groovy index 6cef52fd96edc7..6654d64587db9a 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/newMv/dup_mv_abs.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/newMv/dup_mv_abs.groovy @@ -44,6 +44,8 @@ suite ("dup_mv_abs") { sql "SET enable_fallback_to_original_planner=false" sql "analyze table dup_mv_abs with sync;" + sql """alter table dup_mv_abs modify column k1 set stats ('row_count'='4');""" + sql """set enable_stats=false;""" @@ -68,7 +70,6 @@ suite ("dup_mv_abs") { order_qt_select_group_mv_not "select sum(abs(k2)) from dup_mv_abs group by k3 order by k3;" sql """set enable_stats=true;""" - sql """alter table dup_mv_abs modify column k1 set stats ('row_count'='4');""" mv_rewrite_success("select k1,abs(k2) from dup_mv_abs order by k1;", "k12a") mv_rewrite_success("select abs(k2) from dup_mv_abs order by k1;", "k12a") diff --git a/regression-test/suites/nereids_syntax_p0/mv/newMv/dup_mv_bin.groovy b/regression-test/suites/nereids_syntax_p0/mv/newMv/dup_mv_bin.groovy index 7fd22f5b71892c..16c247498b1598 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/newMv/dup_mv_bin.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/newMv/dup_mv_bin.groovy @@ -45,6 +45,8 @@ suite ("dup_mv_bin") { sql "SET enable_fallback_to_original_planner=false" sql "analyze table dup_mv_bin with sync;" + sql """alter table dup_mv_bin modify column k1 set stats ('row_count'='4');""" + sql """set enable_stats=false;""" @@ -69,7 +71,6 @@ suite ("dup_mv_bin") { order_qt_select_group_mv_not "select group_concat(bin(k2)) from dup_mv_bin group by k3 order by k3;" sql """set enable_stats=true;""" - sql """alter table dup_mv_bin modify column k1 set stats ('row_count'='4');""" mv_rewrite_success("select k1,bin(k2) from dup_mv_bin order by k1;", "k12b") mv_rewrite_success("select bin(k2) from dup_mv_bin order by k1;", "k12b") diff --git a/regression-test/suites/nereids_syntax_p0/mv/newMv/dup_mv_bm_hash.groovy b/regression-test/suites/nereids_syntax_p0/mv/newMv/dup_mv_bm_hash.groovy index f5784e7a5fdaa6..b7a594031d3d49 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/newMv/dup_mv_bm_hash.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/newMv/dup_mv_bm_hash.groovy @@ -39,13 +39,14 @@ suite ("dup_mv_bm_hash") { sql "SET enable_fallback_to_original_planner=false" sql "analyze table dup_mv_bm_hash with sync;" + sql """alter table dup_mv_bm_hash modify column k1 set stats ('row_count'='5');""" + sql """set enable_stats=false;""" mv_rewrite_success("select bitmap_union_count(to_bitmap(k2)) from dup_mv_bm_hash group by k1 order by k1;", "dup_mv_bm_hash_mv1") order_qt_select_mv "select bitmap_union_count(to_bitmap(k2)) from dup_mv_bm_hash group by k1 order by k1;" sql """set enable_stats=true;""" - sql """alter table dup_mv_bm_hash modify column k1 set stats ('row_count'='5');""" mv_rewrite_success("select bitmap_union_count(to_bitmap(k2)) from dup_mv_bm_hash group by k1 order by k1;", "dup_mv_bm_hash_mv1") createMV("create materialized view dup_mv_bm_hash_mv2 as select k1,bitmap_union(bitmap_hash(k3)) from dup_mv_bm_hash group by k1;") diff --git a/regression-test/suites/nereids_syntax_p0/mv/newMv/dup_mv_plus.groovy b/regression-test/suites/nereids_syntax_p0/mv/newMv/dup_mv_plus.groovy index d96d2e07843dd9..bdd8e479553e4a 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/newMv/dup_mv_plus.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/newMv/dup_mv_plus.groovy @@ -44,6 +44,8 @@ suite ("dup_mv_plus") { sql "SET enable_fallback_to_original_planner=false" sql "analyze table dup_mv_plus with sync;" + sql """alter table dup_mv_plus modify column k1 set stats ('row_count'='4');""" + sql """set enable_stats=false;""" order_qt_select_star "select * from dup_mv_plus order by k1;" @@ -85,7 +87,6 @@ suite ("dup_mv_plus") { order_qt_select_mv "select k1,k2+1 from dup_mv_plus order by k2;" sql """set enable_stats=true;""" - sql """alter table dup_mv_plus modify column k1 set stats ('row_count'='4');""" mv_rewrite_success("select k1,k2+1 from dup_mv_plus order by k1;", "k12p") diff --git a/regression-test/suites/nereids_syntax_p0/mv/newMv/dup_mv_year.groovy b/regression-test/suites/nereids_syntax_p0/mv/newMv/dup_mv_year.groovy index 95902c27866481..1e8df8ba91dc00 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/newMv/dup_mv_year.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/newMv/dup_mv_year.groovy @@ -38,6 +38,8 @@ suite ("dup_mv_year") { sql "SET enable_fallback_to_original_planner=false" sql "analyze table dup_mv_year with sync;" + sql """alter table dup_mv_year modify column k1 set stats ('row_count'='4');""" + sql """set enable_stats=false;""" @@ -45,7 +47,6 @@ suite ("dup_mv_year") { order_qt_select_mv "select k1,year(k2) from dup_mv_year order by k1;" sql """set enable_stats=true;""" - sql """alter table dup_mv_year modify column k1 set stats ('row_count'='4');""" mv_rewrite_success("select k1,year(k2) from dup_mv_year order by k1;", "k12y") createMV "create materialized view k13y as select k1,year(k3) from dup_mv_year;" diff --git a/regression-test/suites/nereids_syntax_p0/mv/newMv/multi_slot1.groovy b/regression-test/suites/nereids_syntax_p0/mv/newMv/multi_slot1.groovy index d0fa214e98f042..87bf167f77fd43 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/newMv/multi_slot1.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/newMv/multi_slot1.groovy @@ -44,6 +44,8 @@ suite ("multi_slot1") { sql "SET enable_fallback_to_original_planner=false" sql "analyze table multi_slot1 with sync;" + sql """alter table multi_slot1 modify column k1 set stats ('row_count'='4');""" + sql """set enable_stats=false;""" order_qt_select_star "select * from multi_slot1 order by k1;" @@ -52,6 +54,5 @@ suite ("multi_slot1") { order_qt_select_mv "select abs(k1)+k2+1,abs(k2+2)+k3+3 from multi_slot1 order by abs(k1)+k2+1,abs(k2+2)+k3+3;" sql """set enable_stats=true;""" - sql """alter table multi_slot1 modify column k1 set stats ('row_count'='4');""" mv_rewrite_success("select abs(k1)+k2+1,abs(k2+2)+k3+3 from multi_slot1 order by abs(k1)+k2+1,abs(k2+2)+k3+3", "k1a2p2ap3p") } diff --git a/regression-test/suites/nereids_syntax_p0/mv/newMv/multi_slot2.groovy b/regression-test/suites/nereids_syntax_p0/mv/newMv/multi_slot2.groovy index 0fa36b77b44114..59b301a5110d3f 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/newMv/multi_slot2.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/newMv/multi_slot2.groovy @@ -52,6 +52,8 @@ suite ("multi_slot2") { sql "SET enable_fallback_to_original_planner=false" sql "analyze table multi_slot2 with sync;" + sql """alter table multi_slot2 modify column k1 set stats ('row_count'='4');""" + sql """set enable_stats=false;""" @@ -65,7 +67,6 @@ suite ("multi_slot2") { order_qt_select_base "select abs(k1)+k2+1,sum(abs(k2+2)+k3+3) from multi_slot2 group by abs(k1)+k2 order by abs(k1)+k2;" sql """set enable_stats=true;""" - sql """alter table multi_slot2 modify column k1 set stats ('row_count'='4');""" mv_rewrite_success("select abs(k1)+k2+1,sum(abs(k2+2)+k3+3) from multi_slot2 group by abs(k1)+k2+1 order by abs(k1)+k2+1", "k1a2p2ap3ps") diff --git a/regression-test/suites/nereids_syntax_p0/mv/newMv/multi_slot3.groovy b/regression-test/suites/nereids_syntax_p0/mv/newMv/multi_slot3.groovy index 51cc90aaf6ae26..9ecce84a0ea65f 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/newMv/multi_slot3.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/newMv/multi_slot3.groovy @@ -45,6 +45,8 @@ suite ("multi_slot3") { sql "SET enable_fallback_to_original_planner=false" sql "analyze table multi_slot3 with sync;" + sql """alter table multi_slot3 modify column k1 set stats ('row_count'='4');""" + sql """set enable_stats=false;""" order_qt_select_star "select * from multi_slot3 order by k1;" @@ -53,6 +55,5 @@ suite ("multi_slot3") { order_qt_select_mv "select k1+1,abs(k2+2)+k3+3 from multi_slot3 order by k1+1;" sql """set enable_stats=true;""" - sql """alter table multi_slot3 modify column k1 set stats ('row_count'='4');""" mv_rewrite_success("select k1+1,abs(k2+2)+k3+3 from multi_slot3 order by k1+1;", "k1p2ap3p") } diff --git a/regression-test/suites/nereids_syntax_p0/mv/newMv/multi_slot4.groovy b/regression-test/suites/nereids_syntax_p0/mv/newMv/multi_slot4.groovy index 49aba77aad05ff..7a49dbc4b37118 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/newMv/multi_slot4.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/newMv/multi_slot4.groovy @@ -47,6 +47,8 @@ suite ("multi_slot4") { sql "SET enable_fallback_to_original_planner=false" sql "analyze table multi_slot4 with sync;" + sql """alter table multi_slot4 modify column k1 set stats ('row_count'='5');""" + sql """set enable_stats=false;""" @@ -56,6 +58,5 @@ suite ("multi_slot4") { order_qt_select_mv "select k1+1,sum(abs(k2+2)+k3+3) from multi_slot4 group by k1+1 order by k1+1;" sql """set enable_stats=true;""" - sql """alter table multi_slot4 modify column k1 set stats ('row_count'='5');""" mv_rewrite_success("select k1+1,sum(abs(k2+2)+k3+3) from multi_slot4 group by k1+1 order by k1+1;", "k1p2ap3ps") } diff --git a/regression-test/suites/nereids_syntax_p0/mv/newMv/multi_slot5.groovy b/regression-test/suites/nereids_syntax_p0/mv/newMv/multi_slot5.groovy index ebe6c8e57800a4..8c84ea93521845 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/newMv/multi_slot5.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/newMv/multi_slot5.groovy @@ -46,6 +46,8 @@ suite ("multi_slot5") { sql "SET enable_fallback_to_original_planner=false" sql "analyze table multi_slot5 with sync;" + sql """alter table multi_slot5 modify column k1 set stats ('row_count'='5');""" + sql """set enable_stats=false;""" order_qt_select_star "select * from multi_slot5 order by k1,k4;" @@ -58,6 +60,5 @@ suite ("multi_slot5") { order_qt_select_mv "select k1,version() from multi_slot5 order by k1;" sql """set enable_stats=true;""" - sql """alter table multi_slot5 modify column k1 set stats ('row_count'='5');""" mv_rewrite_success("select k1,k2+k3 from multi_slot5 order by k1;", "k123p") } diff --git a/regression-test/suites/nereids_syntax_p0/mv/newMv/multi_slot6.groovy b/regression-test/suites/nereids_syntax_p0/mv/newMv/multi_slot6.groovy index 2ed66fc8477a37..4eb0d427555c20 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/newMv/multi_slot6.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/newMv/multi_slot6.groovy @@ -44,6 +44,8 @@ suite ("multi_slot6") { sql "SET enable_fallback_to_original_planner=false" sql "analyze table multi_slot6 with sync;" + sql """alter table multi_slot6 modify column k1 set stats ('row_count'='4');""" + sql """set enable_stats=false;""" @@ -84,6 +86,5 @@ suite ("multi_slot6") { order_qt_select_mv "select abs(k1)+k2+1,abs(k2+2)+k3+3 from multi_slot6 order by abs(k1)+k2+1,abs(k2+2)+k3+3;" sql """set enable_stats=true;""" - sql """alter table multi_slot6 modify column k1 set stats ('row_count'='4');""" mv_rewrite_success("select abs(k1)+k2+1,abs(k2+2)+k3+3 from multi_slot6 order by abs(k1)+k2+1,abs(k2+2)+k3+3", "k1a2p2ap3p") } diff --git a/regression-test/suites/nereids_syntax_p0/mv/newMv/mv_with_view.groovy b/regression-test/suites/nereids_syntax_p0/mv/newMv/mv_with_view.groovy index 60e7f6fefed232..017fefa6ef674b 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/newMv/mv_with_view.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/newMv/mv_with_view.groovy @@ -41,6 +41,8 @@ suite ("mv_with_view") { sql """insert into d_table select 3,-3,null,'c';""" sql "analyze table d_table with sync;" + sql """alter table d_table modify column k1 set stats ('row_count'='4');""" + sql """set enable_stats=false;""" mv_rewrite_fail("select * from d_table order by k1;", "k312") @@ -67,7 +69,6 @@ suite ("mv_with_view") { qt_select_mv "select * from v_k124 order by k1;" sql """set enable_stats=true;""" - sql """alter table d_table modify column k1 set stats ('row_count'='4');""" mv_rewrite_fail("select * from d_table order by k1;", "k312") sql """ diff --git a/regression-test/suites/nereids_syntax_p0/mv/newMv/single_slot.groovy b/regression-test/suites/nereids_syntax_p0/mv/newMv/single_slot.groovy index 387c155a5e45c8..dd9e68aa723314 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/newMv/single_slot.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/newMv/single_slot.groovy @@ -45,6 +45,8 @@ suite ("single_slot") { sql "SET enable_fallback_to_original_planner=false" sql "analyze table single_slot with sync;" + sql """alter table single_slot modify column k1 set stats ('row_count'='4');""" + sql """set enable_stats=false;""" order_qt_select_star "select * from single_slot order by k1;" @@ -57,6 +59,5 @@ suite ("single_slot") { order_qt_select_mv "select abs(k1)+1 t,sum(abs(k2+1)) from single_slot group by t order by t;" sql """set enable_stats=true;""" - sql """alter table single_slot modify column k1 set stats ('row_count'='4');""" mv_rewrite_success("select abs(k1)+1 t,sum(abs(k2+1)) from single_slot group by t order by t;", "k1ap2spa") } diff --git a/regression-test/suites/nereids_syntax_p0/mv/newMv/sum_devide_count.groovy b/regression-test/suites/nereids_syntax_p0/mv/newMv/sum_devide_count.groovy index be8bc50532ff81..69fac070e42946 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/newMv/sum_devide_count.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/newMv/sum_devide_count.groovy @@ -45,6 +45,8 @@ suite ("sum_devide_count") { sql "insert into sum_devide_count select 3,2,null,'c';" sql "analyze table sum_devide_count with sync;" + sql """alter table sum_devide_count modify column k1 set stats ('row_count'='5');""" + sql """set enable_stats=false;""" qt_select_star "select * from sum_devide_count order by k1,k2,k3,k4;" @@ -62,7 +64,6 @@ suite ("sum_devide_count") { order_qt_select_mv "select sum(k2)/count(k2) from sum_devide_count;" sql """set enable_stats=true;""" - sql """alter table sum_devide_count modify column k1 set stats ('row_count'='5');""" mv_rewrite_success("select k1,k4,sum(k2)/count(k2) from sum_devide_count group by k1,k4 order by k1,k4;", "kavg") mv_rewrite_success("select k1,sum(k2)/count(k2) from sum_devide_count group by k1 order by k1;", "kavg") diff --git a/regression-test/suites/nereids_syntax_p0/mv/newMv/unique_mv.groovy b/regression-test/suites/nereids_syntax_p0/mv/newMv/unique_mv.groovy index 1ebaa8884ab383..cc9b829b35ad21 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/newMv/unique_mv.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/newMv/unique_mv.groovy @@ -42,12 +42,13 @@ suite ("unique_mv") { sql """insert into c5816_t values (1,2,"2023-11-20 00:00:00",4,"adc",12);""" sql "analyze table c5816_t with sync;" + sql """alter table c5816_t modify column org_id set stats ('row_count'='1');""" + sql """set enable_stats=false;""" mv_rewrite_success("SELECT * FROM c5816_t WHERE call_uuid='adc';", "mv_1") sql """set enable_stats=true;""" - sql """alter table c5816_t modify column org_id set stats ('row_count'='1');""" mv_rewrite_success("SELECT * FROM c5816_t WHERE call_uuid='adc';", "mv_1") } diff --git a/regression-test/suites/nereids_syntax_p0/mv/ut/MVMultiUsage.groovy b/regression-test/suites/nereids_syntax_p0/mv/ut/MVMultiUsage.groovy index 2b6b0dd354e4cd..7afb4751013537 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/ut/MVMultiUsage.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/ut/MVMultiUsage.groovy @@ -45,6 +45,8 @@ suite ("MVMultiUsage") { sql """insert into MVMultiUsage values("2020-01-01",1,"a",1,1,1);""" sql "analyze table MVMultiUsage with sync;" + sql """alter table MVMultiUsage modify column time_col set stats ('row_count'='4');""" + sql """set enable_stats=false;""" mv_rewrite_fail("select * from MVMultiUsage order by empid;", "MVMultiUsage_mv") @@ -59,7 +61,6 @@ suite ("MVMultiUsage") { order_qt_select_mv "select * from (select deptno, empid from MVMultiUsage where deptno>100) A join (select deptno, empid from MVMultiUsage where deptno >200) B using (deptno) order by 1;" sql """set enable_stats=true;""" - sql """alter table MVMultiUsage modify column time_col set stats ('row_count'='4');""" mv_rewrite_fail("select * from MVMultiUsage order by empid;", "MVMultiUsage_mv") explain { diff --git a/regression-test/suites/nereids_syntax_p0/mv/ut/MVWithAs.groovy b/regression-test/suites/nereids_syntax_p0/mv/ut/MVWithAs.groovy index 86a85dcc647443..2bdfa533ecbb3b 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/ut/MVWithAs.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/ut/MVWithAs.groovy @@ -45,6 +45,7 @@ suite ("MVWithAs") { sql """insert into MVWithAs values("2020-01-01",1,"a",1);""" sql "analyze table MVWithAs with sync;" + sql """alter table MVWithAs modify column time_col set stats ('row_count'='7');""" sql """set enable_stats=false;""" mv_rewrite_fail("select * from MVWithAs order by time_col;", "MVWithAs_mv") @@ -53,9 +54,6 @@ suite ("MVWithAs") { mv_rewrite_success("select count(tag_id) from MVWithAs t;", "MVWithAs_mv") order_qt_select_mv "select count(tag_id) from MVWithAs t;" - sql """set enable_stats=true;""" - sql """alter table MVWithAs modify column time_col set stats ('row_count'='7');""" - mv_rewrite_fail("select * from MVWithAs order by time_col;", "MVWithAs_mv") mv_rewrite_success("select count(tag_id) from MVWithAs t;", "MVWithAs_mv") diff --git a/regression-test/suites/nereids_syntax_p0/mv/ut/aggCDInBitmap.groovy b/regression-test/suites/nereids_syntax_p0/mv/ut/aggCDInBitmap.groovy index f45d523d423527..a221a4dfd0ce73 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/ut/aggCDInBitmap.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/ut/aggCDInBitmap.groovy @@ -32,6 +32,7 @@ suite ("aggCDInBitmap") { sql """insert into aggCDInBitmap values(3,to_bitmap(3));""" sql "analyze table aggCDInBitmap with sync;" + sql """alter table aggCDInBitmap modify column k1 set stats ('row_count'='3');""" sql """set enable_stats=false;""" order_qt_select_star "select * from aggCDInBitmap order by 1;" @@ -44,7 +45,6 @@ suite ("aggCDInBitmap") { order_qt_select_mv "select k1, count(distinct v1) from aggCDInBitmap group by k1 order by k1;" sql """set enable_stats=true;""" - sql """alter table aggCDInBitmap modify column k1 set stats ('row_count'='3');""" explain { sql("select k1, count(distinct v1) from aggCDInBitmap group by k1;") contains "bitmap_union_count" diff --git a/regression-test/suites/nereids_syntax_p0/mv/ut/aggMVCalcAggFun.groovy b/regression-test/suites/nereids_syntax_p0/mv/ut/aggMVCalcAggFun.groovy index a234661150e732..4924981c60ec19 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/ut/aggMVCalcAggFun.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/ut/aggMVCalcAggFun.groovy @@ -45,6 +45,7 @@ suite ("aggMVCalcAggFun") { sql """insert into aggMVCalcAggFun values("2020-01-01",1,"a",1,1,1);""" sql "analyze table aggMVCalcAggFun with sync;" + sql """alter table aggMVCalcAggFun modify column time_col set stats ('row_count'='4');""" sql """set enable_stats=false;""" mv_rewrite_fail("select * from aggMVCalcAggFun order by empid;", "aggMVCalcAggFunMv") @@ -53,8 +54,6 @@ suite ("aggMVCalcAggFun") { mv_rewrite_fail("select deptno, sum(salary + 1) from aggMVCalcAggFun where deptno > 10 group by deptno;", "aggMVCalcAggFunMv") order_qt_select_mv "select deptno, sum(salary + 1) from aggMVCalcAggFun where deptno > 10 group by deptno order by deptno;" - sql """set enable_stats=true;""" - sql """alter table aggMVCalcAggFun modify column time_col set stats ('row_count'='4');""" mv_rewrite_fail("select * from aggMVCalcAggFun order by empid;", "aggMVCalcAggFunMv")\ mv_rewrite_fail("select deptno, sum(salary + 1) from aggMVCalcAggFun where deptno > 10 group by deptno;", "aggMVCalcAggFunMv") diff --git a/regression-test/suites/nereids_syntax_p0/mv/ut/aggOnAggMV1.groovy b/regression-test/suites/nereids_syntax_p0/mv/ut/aggOnAggMV1.groovy index c29eec40c8da93..a8e96a8e1343c2 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/ut/aggOnAggMV1.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/ut/aggOnAggMV1.groovy @@ -45,6 +45,8 @@ suite ("aggOnAggMV1") { sql """insert into aggOnAggMV1 values("2020-01-01",1,"a",1,1,1);""" sql "analyze table aggOnAggMV1 with sync;" + sql """alter table aggOnAggMV1 modify column time_col set stats ('row_count'='4');""" + sql """set enable_stats=false;""" mv_rewrite_fail("select * from aggOnAggMV1 order by empid;", "aggOnAggMV1_mv") @@ -54,7 +56,6 @@ suite ("aggOnAggMV1") { order_qt_select_mv "select sum(salary), deptno from aggOnAggMV1 group by deptno order by deptno;" sql """set enable_stats=true;""" - sql """alter table aggOnAggMV1 modify column time_col set stats ('row_count'='4');""" mv_rewrite_fail("select * from aggOnAggMV1 order by empid;", "aggOnAggMV1_mv") mv_rewrite_success("select sum(salary), deptno from aggOnAggMV1 group by deptno order by deptno;", "aggOnAggMV1_mv") diff --git a/regression-test/suites/nereids_syntax_p0/mv/ut/aggOnAggMV10.groovy b/regression-test/suites/nereids_syntax_p0/mv/ut/aggOnAggMV10.groovy index e38a27c1db3c53..4af39a4cfcea4a 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/ut/aggOnAggMV10.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/ut/aggOnAggMV10.groovy @@ -44,6 +44,8 @@ suite ("aggOnAggMV10") { sql """insert into aggOnAggMV10 values("2020-01-01",1,"a",1,1,1);""" sql "analyze table aggOnAggMV10 with sync;" + sql """alter table aggOnAggMV10 modify column time_col set stats ('row_count'='4');""" + sql """set enable_stats=false;""" mv_rewrite_fail("select * from aggOnAggMV10 order by empid;", "aggOnAggMV10_mv") @@ -54,7 +56,6 @@ suite ("aggOnAggMV10") { order_qt_select_mv "select deptno, commission, sum(salary) + 1 from aggOnAggMV10 group by rollup (deptno, commission) order by 1,2;" sql """set enable_stats=true;""" - sql """alter table aggOnAggMV10 modify column time_col set stats ('row_count'='4');""" mv_rewrite_fail("select * from aggOnAggMV10 order by empid;", "aggOnAggMV10_mv") mv_rewrite_success("select deptno, commission, sum(salary) + 1 from aggOnAggMV10 group by rollup (deptno, commission);", diff --git a/regression-test/suites/nereids_syntax_p0/mv/ut/aggOnAggMV11.groovy b/regression-test/suites/nereids_syntax_p0/mv/ut/aggOnAggMV11.groovy index b0f379b19476b8..56a47122b5ab28 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/ut/aggOnAggMV11.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/ut/aggOnAggMV11.groovy @@ -45,6 +45,8 @@ suite ("aggOnAggMV11") { sql """insert into aggOnAggMV11 values("2020-01-01",1,"a",1,1,1);""" sql "analyze table aggOnAggMV11 with sync;" + sql """alter table aggOnAggMV11 modify column time_col set stats ('row_count'='4');""" + sql """set enable_stats=false;""" mv_rewrite_fail("select * from aggOnAggMV11 order by empid;", "aggOnAggMV11_mv") @@ -55,7 +57,6 @@ suite ("aggOnAggMV11") { order_qt_select_mv "select deptno, count(salary) + count(1) from aggOnAggMV11 group by deptno order by 1;" sql """set enable_stats=true;""" - sql """alter table aggOnAggMV11 modify column time_col set stats ('row_count'='4');""" mv_rewrite_fail("select * from aggOnAggMV11 order by empid;", "aggOnAggMV11_mv") diff --git a/regression-test/suites/nereids_syntax_p0/mv/ut/aggOnAggMV2.groovy b/regression-test/suites/nereids_syntax_p0/mv/ut/aggOnAggMV2.groovy index 179e22584d32a1..8393af7ebfd2b2 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/ut/aggOnAggMV2.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/ut/aggOnAggMV2.groovy @@ -46,6 +46,8 @@ suite ("aggOnAggMV2") { sleep(3000) sql "analyze table aggOnAggMV2 with sync;" + sql """alter table aggOnAggMV2 modify column time_col set stats ('row_count'='3');""" + sql """set enable_stats=false;""" mv_rewrite_fail("select * from aggOnAggMV2 order by empid;", "aggOnAggMV2_mv") @@ -56,7 +58,6 @@ suite ("aggOnAggMV2") { order_qt_select_mv "select * from (select deptno, sum(salary) as sum_salary from aggOnAggMV2 group by deptno) a where (sum_salary * 2) > 3 order by deptno ;" sql """set enable_stats=true;""" - sql """alter table aggOnAggMV2 modify column time_col set stats ('row_count'='3');""" mv_rewrite_fail("select * from aggOnAggMV2 order by empid;", "aggOnAggMV2_mv") mv_rewrite_success("select * from (select deptno, sum(salary) as sum_salary from aggOnAggMV2 group by deptno) a where (sum_salary * 2) > 3 order by deptno ;", "aggOnAggMV2_mv") diff --git a/regression-test/suites/nereids_syntax_p0/mv/ut/aggOnAggMV3.groovy b/regression-test/suites/nereids_syntax_p0/mv/ut/aggOnAggMV3.groovy index 0b54345099bcb9..48e15d4b10d52d 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/ut/aggOnAggMV3.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/ut/aggOnAggMV3.groovy @@ -46,6 +46,8 @@ suite ("aggOnAggMV3") { sleep(3000) sql "analyze table aggOnAggMV3 with sync;" + sql """alter table aggOnAggMV3 modify column time_col set stats ('row_count'='5');""" + sql """set enable_stats=false;""" mv_rewrite_fail("select * from aggOnAggMV3 order by empid;", "aggOnAggMV3_mv") @@ -56,7 +58,6 @@ suite ("aggOnAggMV3") { order_qt_select_mv "select commission, sum(salary) from aggOnAggMV3 where commission * (deptno + commission) = 100 group by commission order by commission;" sql """set enable_stats=true;""" - sql """alter table aggOnAggMV3 modify column time_col set stats ('row_count'='5');""" mv_rewrite_fail("select * from aggOnAggMV3 order by empid;", "aggOnAggMV3_mv") mv_rewrite_success("select commission, sum(salary) from aggOnAggMV3 where commission * (deptno + commission) = 100 group by commission order by commission;", diff --git a/regression-test/suites/nereids_syntax_p0/mv/ut/aggOnAggMV6.groovy b/regression-test/suites/nereids_syntax_p0/mv/ut/aggOnAggMV6.groovy index 7e2e87718b8e76..37029f0f089098 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/ut/aggOnAggMV6.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/ut/aggOnAggMV6.groovy @@ -44,6 +44,8 @@ suite ("aggOnAggMV6") { sql """insert into aggOnAggMV6 values("2020-01-01",1,"a",1,1,1);""" sql "analyze table aggOnAggMV6 with sync;" + sql """alter table aggOnAggMV6 modify column time_col set stats ('row_count'='4');""" + sql """set enable_stats=false;""" mv_rewrite_fail("select * from aggOnAggMV6 order by empid;", "aggOnAggMV6_mv") @@ -54,7 +56,6 @@ suite ("aggOnAggMV6") { order_qt_select_mv "select * from (select deptno, sum(salary) as sum_salary from aggOnAggMV6 where deptno>=20 group by deptno) a where sum_salary>10 order by 1;" sql """set enable_stats=true;""" - sql """alter table aggOnAggMV6 modify column time_col set stats ('row_count'='4');""" mv_rewrite_fail("select * from aggOnAggMV6 order by empid;", "aggOnAggMV6_mv") mv_rewrite_success("select * from (select deptno, sum(salary) as sum_salary from aggOnAggMV6 where deptno>=20 group by deptno) a where sum_salary>10;", diff --git a/regression-test/suites/nereids_syntax_p0/mv/ut/aggOnAggMV7.groovy b/regression-test/suites/nereids_syntax_p0/mv/ut/aggOnAggMV7.groovy index 386871a8a5a98f..d4db9a05fea0a6 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/ut/aggOnAggMV7.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/ut/aggOnAggMV7.groovy @@ -44,6 +44,7 @@ suite ("aggOnAggMV7") { sql """insert into aggOnAggMV7 values("2020-01-01",1,"a",1,1,1);""" sql "analyze table aggOnAggMV7 with sync;" + sql """alter table aggOnAggMV7 modify column time_col set stats ('row_count'='4');""" sql """set enable_stats=false;""" mv_rewrite_fail("select * from aggOnAggMV7 order by empid;", "aggOnAggMV7_mv") @@ -54,7 +55,6 @@ suite ("aggOnAggMV7") { order_qt_select_mv "select deptno, sum(salary) from aggOnAggMV7 where deptno>=20 group by deptno order by 1;" sql """set enable_stats=true;""" - sql """alter table aggOnAggMV7 modify column time_col set stats ('row_count'='4');""" mv_rewrite_fail("select * from aggOnAggMV7 order by empid;", "aggOnAggMV7_mv") mv_rewrite_success("select deptno, sum(salary) from aggOnAggMV7 where deptno>=20 group by deptno;", diff --git a/regression-test/suites/nereids_syntax_p0/mv/ut/bitmapUnionIn.groovy b/regression-test/suites/nereids_syntax_p0/mv/ut/bitmapUnionIn.groovy index 8b2697cb1f78f7..075393c7e0f7c0 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/ut/bitmapUnionIn.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/ut/bitmapUnionIn.groovy @@ -41,6 +41,7 @@ suite ("bitmapUnionIn") { sql """insert into bitmapUnionIn values("2020-01-01",1,"a",2);""" sql "analyze table bitmapUnionIn with sync;" + sql """alter table bitmapUnionIn modify column time_col set stats ('row_count'='3');""" sql """set enable_stats=false;""" mv_rewrite_fail("select * from bitmapUnionIn order by time_col;", "bitmapUnionIn_mv") @@ -51,7 +52,6 @@ suite ("bitmapUnionIn") { order_qt_select_mv "select user_id, bitmap_union_count(to_bitmap(tag_id)) a from bitmapUnionIn group by user_id having a>1 order by a;" sql """set enable_stats=true;""" - sql """alter table bitmapUnionIn modify column time_col set stats ('row_count'='3');""" mv_rewrite_fail("select * from bitmapUnionIn order by time_col;", "bitmapUnionIn_mv") diff --git a/regression-test/suites/nereids_syntax_p0/mv/ut/distinctQuery.groovy b/regression-test/suites/nereids_syntax_p0/mv/ut/distinctQuery.groovy index f2bd0a94572172..10d86e3c5d07d7 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/ut/distinctQuery.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/ut/distinctQuery.groovy @@ -39,13 +39,13 @@ suite ("distinctQuery") { sql """alter table distinctQuery modify column time_col set stats ('row_count'='5');""" + sql """insert into distinctQuery values("2020-01-01",1,"a",1,1,1);""" + sql """insert into distinctQuery values("2020-01-01",2,"a",1,1,1);""" + createMV("create materialized view distinctQuery_mv as select deptno, count(salary) from distinctQuery group by deptno;") createMV("create materialized view distinctQuery_mv2 as select empid, deptno, count(salary) from distinctQuery group by empid, deptno;") - sql """insert into distinctQuery values("2020-01-01",1,"a",1,1,1);""" - sql """insert into distinctQuery values("2020-01-01",2,"a",1,1,1);""" - sql "analyze table distinctQuery with sync;" mv_rewrite_any_success("select distinct deptno from distinctQuery;", ["distinctQuery_mv", "distinctQuery_mv2"]) diff --git a/regression-test/suites/nereids_syntax_p0/mv/ut/incMVReInSub.groovy b/regression-test/suites/nereids_syntax_p0/mv/ut/incMVReInSub.groovy index 52abff46678bb0..d844cabd229097 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/ut/incMVReInSub.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/ut/incMVReInSub.groovy @@ -42,6 +42,8 @@ suite ("incMVReInSub") { sql """insert into incMVReInSub values("2020-01-01",1,"a",2);""" sql "analyze table incMVReInSub with sync;" + sql """alter table incMVReInSub modify column time_col set stats ('row_count'='3');""" + sql """set enable_stats=false;""" mv_rewrite_fail("select * from incMVReInSub order by time_col;", "incMVReInSub_mv") @@ -53,7 +55,6 @@ suite ("incMVReInSub") { order_qt_select_mv "select user_id, bitmap_union(to_bitmap(tag_id)) from incMVReInSub where user_name in (select user_name from incMVReInSub group by user_name having bitmap_union_count(to_bitmap(tag_id)) >1 ) group by user_id order by user_id;" sql """set enable_stats=true;""" - sql """alter table incMVReInSub modify column time_col set stats ('row_count'='3');""" mv_rewrite_fail("select * from incMVReInSub order by time_col;", "incMVReInSub_mv") diff --git a/regression-test/suites/nereids_syntax_p0/mv/ut/incRewriteCD.groovy b/regression-test/suites/nereids_syntax_p0/mv/ut/incRewriteCD.groovy index 6172773ca7a43b..2ec4531aceb1b4 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/ut/incRewriteCD.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/ut/incRewriteCD.groovy @@ -42,6 +42,8 @@ suite ("incRewriteCD") { sql """insert into incRewriteCD values("2020-01-01",1,"a",2);""" sql "analyze table incRewriteCD with sync;" + sql """alter table incRewriteCD modify column time_col set stats ('row_count'='3');""" + sql """set enable_stats=false;""" mv_rewrite_fail("select * from incRewriteCD order by time_col;", "incRewriteCD_mv") @@ -51,7 +53,6 @@ suite ("incRewriteCD") { order_qt_select_mv "select user_name, count(distinct tag_id) from incRewriteCD group by user_name order by user_name;" sql """set enable_stats=true;""" - sql """alter table incRewriteCD modify column time_col set stats ('row_count'='3');""" mv_rewrite_fail("select * from incRewriteCD order by time_col;", "incRewriteCD_mv") diff --git a/regression-test/suites/nereids_syntax_p0/mv/ut/joinOnCalcToJoin.groovy b/regression-test/suites/nereids_syntax_p0/mv/ut/joinOnCalcToJoin.groovy index 378731dbb97a62..77738b4ce0fa57 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/ut/joinOnCalcToJoin.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/ut/joinOnCalcToJoin.groovy @@ -59,13 +59,14 @@ suite ("joinOnCalcToJoin") { sql "analyze table joinOnCalcToJoin with sync;" sql "analyze table joinOnCalcToJoin_1 with sync;" + sql """alter table joinOnCalcToJoin_1 modify column time_col set stats ('row_count'='3');""" + sql """set enable_stats=false;""" mv_rewrite_all_success("select * from (select empid, deptno from joinOnCalcToJoin where empid = 0) A join (select deptno, cost from joinOnCalcToJoin_1 where deptno > 0) B on A.deptno = B.deptno;", ["joinOnLeftPToJoin_mv", "joinOnLeftPToJoin_1_mv"]) sql """set enable_stats=true;""" - sql """alter table joinOnCalcToJoin_1 modify column time_col set stats ('row_count'='3');""" mv_rewrite_all_success("select * from (select empid, deptno from joinOnCalcToJoin where empid = 0) A join (select deptno, cost from joinOnCalcToJoin_1 where deptno > 0) B on A.deptno = B.deptno;", ["joinOnLeftPToJoin_mv", "joinOnLeftPToJoin_1_mv"]) diff --git a/regression-test/suites/nereids_syntax_p0/mv/ut/joinOnLeftPToJoin.groovy b/regression-test/suites/nereids_syntax_p0/mv/ut/joinOnLeftPToJoin.groovy index 69d1c39931c17f..41364f74330e0d 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/ut/joinOnLeftPToJoin.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/ut/joinOnLeftPToJoin.groovy @@ -59,6 +59,8 @@ suite ("joinOnLeftPToJoin") { sql "analyze table joinOnLeftPToJoin with sync;" sql "analyze table joinOnLeftPToJoin_1 with sync;" + sql """alter table joinOnLeftPToJoin_1 modify column time_col set stats ('row_count'='3');""" + sql """set enable_stats=false;""" mv_rewrite_all_success("select * from (select deptno , sum(salary) from joinOnLeftPToJoin group by deptno) A join (select deptno, max(cost) from joinOnLeftPToJoin_1 group by deptno ) B on A.deptno = B.deptno;", @@ -67,7 +69,6 @@ suite ("joinOnLeftPToJoin") { order_qt_select_mv "select * from (select deptno , sum(salary) from joinOnLeftPToJoin group by deptno) A join (select deptno, max(cost) from joinOnLeftPToJoin_1 group by deptno ) B on A.deptno = B.deptno order by A.deptno;" sql """set enable_stats=true;""" - sql """alter table joinOnLeftPToJoin_1 modify column time_col set stats ('row_count'='3');""" mv_rewrite_all_success("select * from (select deptno , sum(salary) from joinOnLeftPToJoin group by deptno) A join (select deptno, max(cost) from joinOnLeftPToJoin_1 group by deptno ) B on A.deptno = B.deptno;", ["joinOnLeftPToJoin_mv", "joinOnLeftPToJoin_1_mv"]) diff --git a/regression-test/suites/nereids_syntax_p0/mv/ut/onlyGroupBy.groovy b/regression-test/suites/nereids_syntax_p0/mv/ut/onlyGroupBy.groovy index e36ae20e9bcb11..227535abf6aafb 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/ut/onlyGroupBy.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/ut/onlyGroupBy.groovy @@ -43,12 +43,11 @@ suite ("onlyGroupBy") { sql """insert into onlyGroupBy values("2020-01-01",1,"a",1,1,1);""" sql "analyze table onlyGroupBy with sync;" + sql """alter table onlyGroupBy modify column time_col set stats ('row_count'='4');""" sql """set enable_stats=false;""" mv_rewrite_success("select deptno from onlyGroupBy group by deptno;", "onlyGroupBy_mv") sql """set enable_stats=true;""" - sql """alter table onlyGroupBy modify column time_col set stats ('row_count'='4');""" - mv_rewrite_success("select deptno from onlyGroupBy group by deptno;", "onlyGroupBy_mv") } diff --git a/regression-test/suites/nereids_syntax_p0/mv/ut/orderByOnPView.groovy b/regression-test/suites/nereids_syntax_p0/mv/ut/orderByOnPView.groovy index 21864f973ee8c0..5209b44509a154 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/ut/orderByOnPView.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/ut/orderByOnPView.groovy @@ -45,6 +45,8 @@ suite ("orderByOnPView") { sql """insert into orderByOnPView values("2020-01-01",1,"a",1,1,1);""" sql "analyze table orderByOnPView with sync;" + sql """alter table orderByOnPView modify column time_col set stats ('row_count'='4');""" + sql """set enable_stats=false;""" mv_rewrite_fail("select * from orderByOnPView where time_col='2020-01-01' order by empid;", "orderByOnPView_mv") @@ -54,7 +56,6 @@ suite ("orderByOnPView") { order_qt_select_mv "select empid from orderByOnPView order by deptno;" sql """set enable_stats=true;""" - sql """alter table orderByOnPView modify column time_col set stats ('row_count'='4');""" mv_rewrite_fail("select * from orderByOnPView where time_col='2020-01-01' order by empid;", "orderByOnPView_mv") diff --git a/regression-test/suites/nereids_syntax_p0/mv/ut/projectMV1.groovy b/regression-test/suites/nereids_syntax_p0/mv/ut/projectMV1.groovy index 157a15498e717c..33a54b4da41f03 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/ut/projectMV1.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/ut/projectMV1.groovy @@ -44,6 +44,8 @@ suite ("projectMV1") { sql """insert into projectMV1 values("2020-01-01",1,"a",1,1,1);""" sql "analyze table projectMV1 with sync;" + sql """alter table projectMV1 modify column time_col set stats ('row_count'='3');""" + sql """set enable_stats=false;""" mv_rewrite_fail("select * from projectMV1 where time_col='2020-01-01' order by empid;", "projectMV1_mv") @@ -53,7 +55,6 @@ suite ("projectMV1") { order_qt_select_mv "select empid, deptno from projectMV1 order by empid;" sql """set enable_stats=true;""" - sql """alter table projectMV1 modify column time_col set stats ('row_count'='3');""" mv_rewrite_fail("select * from projectMV1 where time_col='2020-01-01' order by empid;", "projectMV1_mv") diff --git a/regression-test/suites/nereids_syntax_p0/mv/ut/projectMV2.groovy b/regression-test/suites/nereids_syntax_p0/mv/ut/projectMV2.groovy index 4d85fcc9c8aeae..8702cb05721647 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/ut/projectMV2.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/ut/projectMV2.groovy @@ -44,6 +44,8 @@ suite ("projectMV2") { sql """insert into projectMV2 values("2020-01-01",1,"a",1,1,1);""" sql "analyze table projectMV2 with sync;" + sql """alter table projectMV2 modify column time_col set stats ('row_count'='3');""" + sql """set enable_stats=false;""" mv_rewrite_fail("select * from projectMV2 order by empid;", "projectMV2_mv") @@ -56,7 +58,6 @@ suite ("projectMV2") { order_qt_select_base "select name from projectMV2 where deptno -1 = 0 order by empid;" sql """set enable_stats=true;""" - sql """alter table projectMV2 modify column time_col set stats ('row_count'='3');""" mv_rewrite_fail("select * from projectMV2 order by empid;", "projectMV2_mv") diff --git a/regression-test/suites/nereids_syntax_p0/mv/ut/projectMV3.groovy b/regression-test/suites/nereids_syntax_p0/mv/ut/projectMV3.groovy index 9ad301fbbc6a97..bcc974fca14ee8 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/ut/projectMV3.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/ut/projectMV3.groovy @@ -46,6 +46,7 @@ suite ("projectMV3") { sql """insert into projectMV3 values("2020-01-01",1,"a",1,1,1);""" sql "analyze table projectMV3 with sync;" + sql """alter table projectMV3 modify column time_col set stats ('row_count'='3');""" sql """set enable_stats=false;""" mv_rewrite_fail("select * from projectMV3 order by empid;", "projectMV3_mv") diff --git a/regression-test/suites/nereids_syntax_p0/mv/ut/projectMV4.groovy b/regression-test/suites/nereids_syntax_p0/mv/ut/projectMV4.groovy index ddcdada549ad8f..3963b4338b7a25 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/ut/projectMV4.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/ut/projectMV4.groovy @@ -46,6 +46,8 @@ suite ("projectMV4") { sql """insert into projectMV4 values("2020-01-01",1,"a",1,1,1);""" sql "analyze table projectMV4 with sync;" + sql """alter table projectMV4 modify column time_col set stats ('row_count'='3');""" + sql """set enable_stats=false;""" mv_rewrite_fail("select * from projectMV4 order by empid;", "projectMV4_mv") @@ -58,7 +60,6 @@ suite ("projectMV4") { order_qt_select_base "select empid from projectMV4 where deptno > 1 and empid > 1 order by empid;" sql """set enable_stats=true;""" - sql """alter table projectMV4 modify column time_col set stats ('row_count'='3');""" mv_rewrite_fail("select * from projectMV4 order by empid;", "projectMV4_mv") diff --git a/regression-test/suites/nereids_syntax_p0/mv/ut/subQuery.groovy b/regression-test/suites/nereids_syntax_p0/mv/ut/subQuery.groovy index 67312eed088ed4..6667c9dcd6fe15 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/ut/subQuery.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/ut/subQuery.groovy @@ -44,6 +44,8 @@ suite ("subQuery") { sql """insert into subQuery values("2020-01-01",1,"a",1,1,1);""" sql "analyze table subQuery with sync;" + sql """alter table subQuery modify column time_col set stats ('row_count'='4');""" + sql """set enable_stats=false;""" mv_rewrite_fail("select * from subQuery order by empid;", "subQuery_mv") @@ -59,7 +61,6 @@ suite ("subQuery") { */ sql """set enable_stats=true;""" - sql """alter table subQuery modify column time_col set stats ('row_count'='4');""" mv_rewrite_fail("select * from subQuery order by empid;", "subQuery_mv") } diff --git a/regression-test/suites/nereids_syntax_p0/mv/ut/unionDis.groovy b/regression-test/suites/nereids_syntax_p0/mv/ut/unionDis.groovy index 9feb1aa1c975f5..cb0661f4e3a1e6 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/ut/unionDis.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/ut/unionDis.groovy @@ -44,6 +44,8 @@ suite ("unionDis") { sql """insert into unionDis values("2020-01-01",1,"a",1,1,1);""" sql "analyze table unionDis with sync;" + sql """alter table unionDis modify column time_col set stats ('row_count'='4');""" + sql """set enable_stats=false;""" mv_rewrite_fail("select * from unionDis order by empid;", "unionDis_mv") @@ -58,7 +60,6 @@ suite ("unionDis") { order_qt_select_mv "select * from (select empid, deptno from unionDis where empid >1 union select empid, deptno from unionDis where empid <0) t order by 1;" sql """set enable_stats=true;""" - sql """alter table unionDis modify column time_col set stats ('row_count'='4');""" mv_rewrite_fail("select * from unionDis order by empid;", "unionDis_mv") diff --git a/regression-test/suites/nereids_syntax_p0/rollup/hll/hll.groovy b/regression-test/suites/nereids_syntax_p0/rollup/hll/hll.groovy index 5002c509a20617..e5963b392f597d 100644 --- a/regression-test/suites/nereids_syntax_p0/rollup/hll/hll.groovy +++ b/regression-test/suites/nereids_syntax_p0/rollup/hll/hll.groovy @@ -36,6 +36,8 @@ suite("hll", "rollup") { qt_sql "desc test_materialized_view_hll1 all"; sql "analyze table test_materialized_view_hll1 with sync;" + sql """alter table test_materialized_view_hll1 modify column record_id set stats ('row_count'='2');""" + sql """set enable_stats=false;""" explain { @@ -46,7 +48,6 @@ suite("hll", "rollup") { "amt_count") sql """set enable_stats=true;""" - sql """alter table test_materialized_view_hll1 modify column record_id set stats ('row_count'='2');""" mv_rewrite_success("SELECT store_id, hll_union_agg(hll_hash(sale_amt)) FROM test_materialized_view_hll1 GROUP BY store_id;", "amt_count") } diff --git a/regression-test/suites/nereids_syntax_p0/rollup/hll_with_light_sc/hll_with_light_sc.groovy b/regression-test/suites/nereids_syntax_p0/rollup/hll_with_light_sc/hll_with_light_sc.groovy index d7dec7696d95eb..e1d6aa48c4e205 100644 --- a/regression-test/suites/nereids_syntax_p0/rollup/hll_with_light_sc/hll_with_light_sc.groovy +++ b/regression-test/suites/nereids_syntax_p0/rollup/hll_with_light_sc/hll_with_light_sc.groovy @@ -37,13 +37,14 @@ suite("hll_with_light_sc", "rollup") { qt_sql "SELECT store_id, hll_union_agg(hll_hash(sale_amt)) FROM test_materialized_view_hll_with_light_sc1 GROUP BY store_id;" sql "analyze table test_materialized_view_hll_with_light_sc1 with sync;" + sql """alter table test_materialized_view_hll_with_light_sc1 modify column record_id set stats ('row_count'='2');""" + sql """set enable_stats=false;""" mv_rewrite_success("SELECT store_id, hll_union_agg(hll_hash(sale_amt)) FROM test_materialized_view_hll_with_light_sc1 GROUP BY store_id;", "amt_count1") sql """set enable_stats=true;""" - sql """alter table test_materialized_view_hll_with_light_sc1 modify column record_id set stats ('row_count'='2');""" mv_rewrite_success("SELECT store_id, hll_union_agg(hll_hash(sale_amt)) FROM test_materialized_view_hll_with_light_sc1 GROUP BY store_id;", "amt_count1") }