diff --git a/regression-test/data/nereids_syntax_p1/mv/aggregate/agg_sync_mv.out b/regression-test/data/nereids_syntax_p1/mv/aggregate/agg_sync_mv.out index fee553ed3d091de..848d637c916a930 100644 --- a/regression-test/data/nereids_syntax_p1/mv/aggregate/agg_sync_mv.out +++ b/regression-test/data/nereids_syntax_p1/mv/aggregate/agg_sync_mv.out @@ -90,34 +90,34 @@ 11 [12] -- !select_collect_list -- -\N [1, 1, 1, 1, 1] -0 [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] -1 [2, 2, 2, 2, 2, 2, 2, 2, 2, 2] -2 [3, 3, 3, 3, 3, 3, 3, 3, 3, 3] -3 [4, 4, 4, 4, 4, 4, 4, 4, 4, 4] -4 [5, 5, 5, 5, 5, 5, 5, 5, 5, 5] -5 [6, 6, 6, 6, 6, 6, 6, 6, 6, 6] -6 [7, 7, 7, 7, 7, 7, 7, 7, 7, 7] -7 [8, 8, 8, 8, 8, 8, 8, 8, 8, 8] -8 [9, 9, 9, 9, 9, 9, 9, 9, 9, 9] -9 [10, 10, 10, 10, 10, 10, 10, 10, 10, 10] -10 [11, 11, 11, 11, 11, 11, 11, 11, 11, 11] -11 [12, 12, 12, 12, 12, 12, 12, 12, 12, 12] +\N [1] +0 [1, 1] +1 [2, 2] +2 [3, 3] +3 [4, 4] +4 [5, 5] +5 [6, 6] +6 [7, 7] +7 [8, 8] +8 [9, 9] +9 [10, 10] +10 [11, 11] +11 [12, 12] -- !select_collect_list_mv -- -\N [1, 1, 1, 1, 1] -0 [1, 1, 1, 1, 1, 1, 1, 1, 1, 1] -1 [2, 2, 2, 2, 2, 2, 2, 2, 2, 2] -2 [3, 3, 3, 3, 3, 3, 3, 3, 3, 3] -3 [4, 4, 4, 4, 4, 4, 4, 4, 4, 4] -4 [5, 5, 5, 5, 5, 5, 5, 5, 5, 5] -5 [6, 6, 6, 6, 6, 6, 6, 6, 6, 6] -6 [7, 7, 7, 7, 7, 7, 7, 7, 7, 7] -7 [8, 8, 8, 8, 8, 8, 8, 8, 8, 8] -8 [9, 9, 9, 9, 9, 9, 9, 9, 9, 9] -9 [10, 10, 10, 10, 10, 10, 10, 10, 10, 10] -10 [11, 11, 11, 11, 11, 11, 11, 11, 11, 11] -11 [12, 12, 12, 12, 12, 12, 12, 12, 12, 12] +\N [1] +0 [1, 1] +1 [2, 2] +2 [3, 3] +3 [4, 4] +4 [5, 5] +5 [6, 6] +6 [7, 7] +7 [8, 8] +8 [9, 9] +9 [10, 10] +10 [11, 11] +11 [12, 12] -- !select_corr -- \N 0.0 @@ -210,34 +210,34 @@ 11 \N -- !select_count_by_enum -- -\N [{"cbe":{"string1":5,"null":10},"notnull":15,"null":0,"all":15}] -0 [{"cbe":{"string1":10},"notnull":10,"null":0,"all":10}] -1 [{"cbe":{"string2":10},"notnull":10,"null":0,"all":10}] -2 [{"cbe":{"string3":10},"notnull":10,"null":0,"all":10}] -3 [{"cbe":{"string1":10},"notnull":10,"null":0,"all":10}] -4 [{"cbe":{"string2":10},"notnull":10,"null":0,"all":10}] -5 [{"cbe":{"string3":10},"notnull":10,"null":0,"all":10}] -6 [{"cbe":{"string1":10},"notnull":10,"null":0,"all":10}] -7 [{"cbe":{"string2":10},"notnull":10,"null":0,"all":10}] -8 [{"cbe":{"string3":10},"notnull":10,"null":0,"all":10}] -9 [{"cbe":{"string1":10},"notnull":10,"null":0,"all":10}] -10 [{"cbe":{"string2":10},"notnull":10,"null":0,"all":10}] -11 [{"cbe":{"string3":10},"notnull":10,"null":0,"all":10}] +\N [{"cbe":{"string1":1,"null":2},"notnull":3,"null":0,"all":3}] +0 [{"cbe":{"string1":2},"notnull":2,"null":0,"all":2}] +1 [{"cbe":{"string2":2},"notnull":2,"null":0,"all":2}] +2 [{"cbe":{"string3":2},"notnull":2,"null":0,"all":2}] +3 [{"cbe":{"string1":2},"notnull":2,"null":0,"all":2}] +4 [{"cbe":{"string2":2},"notnull":2,"null":0,"all":2}] +5 [{"cbe":{"string3":2},"notnull":2,"null":0,"all":2}] +6 [{"cbe":{"string1":2},"notnull":2,"null":0,"all":2}] +7 [{"cbe":{"string2":2},"notnull":2,"null":0,"all":2}] +8 [{"cbe":{"string3":2},"notnull":2,"null":0,"all":2}] +9 [{"cbe":{"string1":2},"notnull":2,"null":0,"all":2}] +10 [{"cbe":{"string2":2},"notnull":2,"null":0,"all":2}] +11 [{"cbe":{"string3":2},"notnull":2,"null":0,"all":2}] -- !select_count_by_enum_mv -- -\N [{"cbe":{"string1":5,"null":10},"notnull":15,"null":0,"all":15}] -0 [{"cbe":{"string1":10},"notnull":10,"null":0,"all":10}] -1 [{"cbe":{"string2":10},"notnull":10,"null":0,"all":10}] -2 [{"cbe":{"string3":10},"notnull":10,"null":0,"all":10}] -3 [{"cbe":{"string1":10},"notnull":10,"null":0,"all":10}] -4 [{"cbe":{"string2":10},"notnull":10,"null":0,"all":10}] -5 [{"cbe":{"string3":10},"notnull":10,"null":0,"all":10}] -6 [{"cbe":{"string1":10},"notnull":10,"null":0,"all":10}] -7 [{"cbe":{"string2":10},"notnull":10,"null":0,"all":10}] -8 [{"cbe":{"string3":10},"notnull":10,"null":0,"all":10}] -9 [{"cbe":{"string1":10},"notnull":10,"null":0,"all":10}] -10 [{"cbe":{"string2":10},"notnull":10,"null":0,"all":10}] -11 [{"cbe":{"string3":10},"notnull":10,"null":0,"all":10}] +\N [{"cbe":{"string1":1,"null":2},"notnull":3,"null":0,"all":3}] +0 [{"cbe":{"string1":2},"notnull":2,"null":0,"all":2}] +1 [{"cbe":{"string2":2},"notnull":2,"null":0,"all":2}] +2 [{"cbe":{"string3":2},"notnull":2,"null":0,"all":2}] +3 [{"cbe":{"string1":2},"notnull":2,"null":0,"all":2}] +4 [{"cbe":{"string2":2},"notnull":2,"null":0,"all":2}] +5 [{"cbe":{"string3":2},"notnull":2,"null":0,"all":2}] +6 [{"cbe":{"string1":2},"notnull":2,"null":0,"all":2}] +7 [{"cbe":{"string2":2},"notnull":2,"null":0,"all":2}] +8 [{"cbe":{"string3":2},"notnull":2,"null":0,"all":2}] +9 [{"cbe":{"string1":2},"notnull":2,"null":0,"all":2}] +10 [{"cbe":{"string2":2},"notnull":2,"null":0,"all":2}] +11 [{"cbe":{"string3":2},"notnull":2,"null":0,"all":2}] -- !select_avg_weighted -- \N 1.0 @@ -247,11 +247,11 @@ 3 4.0 4 5.0 5 6.0 -6 6.999999999999999 +6 7.0 7 8.0 8 9.0 9 10.0 -10 11.000000000000002 +10 11.0 11 12.0 -- !select_avg_weighted_mv -- @@ -262,11 +262,11 @@ 3 4.0 4 5.0 5 6.0 -6 6.999999999999999 +6 7.0 7 8.0 8 9.0 9 10.0 -10 11.000000000000002 +10 11.0 11 12.0 -- !select_bitmap_intersect -- @@ -660,34 +660,34 @@ 11 0 -- !select_group_concat -- -\N 1,1,1,1,1 -0 1,1,1,1,1,1,1,1,1,1 -1 2,2,2,2,2,2,2,2,2,2 -2 3,3,3,3,3,3,3,3,3,3 -3 4,4,4,4,4,4,4,4,4,4 -4 5,5,5,5,5,5,5,5,5,5 -5 6,6,6,6,6,6,6,6,6,6 -6 7,7,7,7,7,7,7,7,7,7 -7 8,8,8,8,8,8,8,8,8,8 -8 9,9,9,9,9,9,9,9,9,9 -9 10,10,10,10,10,10,10,10,10,10 -10 11,11,11,11,11,11,11,11,11,11 -11 12,12,12,12,12,12,12,12,12,12 +\N 1 +0 1,1 +1 2,2 +2 3,3 +3 4,4 +4 5,5 +5 6,6 +6 7,7 +7 8,8 +8 9,9 +9 10,10 +10 11,11 +11 12,12 -- !select_group_concat_mv -- -\N 1,1,1,1,1 -0 1,1,1,1,1,1,1,1,1,1 -1 2,2,2,2,2,2,2,2,2,2 -2 3,3,3,3,3,3,3,3,3,3 -3 4,4,4,4,4,4,4,4,4,4 -4 5,5,5,5,5,5,5,5,5,5 -5 6,6,6,6,6,6,6,6,6,6 -6 7,7,7,7,7,7,7,7,7,7 -7 8,8,8,8,8,8,8,8,8,8 -8 9,9,9,9,9,9,9,9,9,9 -9 10,10,10,10,10,10,10,10,10,10 -10 11,11,11,11,11,11,11,11,11,11 -11 12,12,12,12,12,12,12,12,12,12 +\N 1 +0 1,1 +1 2,2 +2 3,3 +3 4,4 +4 5,5 +5 6,6 +6 7,7 +7 8,8 +8 9,9 +9 10,10 +10 11,11 +11 12,12 -- !select_multi_distinct_group_concat -- \N 1 @@ -780,34 +780,34 @@ 11 12 -- !select_histogram -- -\N {"num_buckets":1,"buckets":[{"lower":"1","upper":"1","ndv":1,"count":5,"pre_sum":0}]} -0 {"num_buckets":1,"buckets":[{"lower":"1","upper":"1","ndv":1,"count":10,"pre_sum":0}]} -1 {"num_buckets":1,"buckets":[{"lower":"2","upper":"2","ndv":1,"count":10,"pre_sum":0}]} -2 {"num_buckets":1,"buckets":[{"lower":"3","upper":"3","ndv":1,"count":10,"pre_sum":0}]} -3 {"num_buckets":1,"buckets":[{"lower":"4","upper":"4","ndv":1,"count":10,"pre_sum":0}]} -4 {"num_buckets":1,"buckets":[{"lower":"5","upper":"5","ndv":1,"count":10,"pre_sum":0}]} -5 {"num_buckets":1,"buckets":[{"lower":"6","upper":"6","ndv":1,"count":10,"pre_sum":0}]} -6 {"num_buckets":1,"buckets":[{"lower":"7","upper":"7","ndv":1,"count":10,"pre_sum":0}]} -7 {"num_buckets":1,"buckets":[{"lower":"8","upper":"8","ndv":1,"count":10,"pre_sum":0}]} -8 {"num_buckets":1,"buckets":[{"lower":"9","upper":"9","ndv":1,"count":10,"pre_sum":0}]} -9 {"num_buckets":1,"buckets":[{"lower":"10","upper":"10","ndv":1,"count":10,"pre_sum":0}]} -10 {"num_buckets":1,"buckets":[{"lower":"11","upper":"11","ndv":1,"count":10,"pre_sum":0}]} -11 {"num_buckets":1,"buckets":[{"lower":"12","upper":"12","ndv":1,"count":10,"pre_sum":0}]} +\N {"num_buckets":1,"buckets":[{"lower":"1","upper":"1","ndv":1,"count":1,"pre_sum":0}]} +0 {"num_buckets":1,"buckets":[{"lower":"1","upper":"1","ndv":1,"count":2,"pre_sum":0}]} +1 {"num_buckets":1,"buckets":[{"lower":"2","upper":"2","ndv":1,"count":2,"pre_sum":0}]} +2 {"num_buckets":1,"buckets":[{"lower":"3","upper":"3","ndv":1,"count":2,"pre_sum":0}]} +3 {"num_buckets":1,"buckets":[{"lower":"4","upper":"4","ndv":1,"count":2,"pre_sum":0}]} +4 {"num_buckets":1,"buckets":[{"lower":"5","upper":"5","ndv":1,"count":2,"pre_sum":0}]} +5 {"num_buckets":1,"buckets":[{"lower":"6","upper":"6","ndv":1,"count":2,"pre_sum":0}]} +6 {"num_buckets":1,"buckets":[{"lower":"7","upper":"7","ndv":1,"count":2,"pre_sum":0}]} +7 {"num_buckets":1,"buckets":[{"lower":"8","upper":"8","ndv":1,"count":2,"pre_sum":0}]} +8 {"num_buckets":1,"buckets":[{"lower":"9","upper":"9","ndv":1,"count":2,"pre_sum":0}]} +9 {"num_buckets":1,"buckets":[{"lower":"10","upper":"10","ndv":1,"count":2,"pre_sum":0}]} +10 {"num_buckets":1,"buckets":[{"lower":"11","upper":"11","ndv":1,"count":2,"pre_sum":0}]} +11 {"num_buckets":1,"buckets":[{"lower":"12","upper":"12","ndv":1,"count":2,"pre_sum":0}]} -- !select_histogram_mv -- -\N {"num_buckets":1,"buckets":[{"lower":"1","upper":"1","ndv":1,"count":5,"pre_sum":0}]} -0 {"num_buckets":1,"buckets":[{"lower":"1","upper":"1","ndv":1,"count":10,"pre_sum":0}]} -1 {"num_buckets":1,"buckets":[{"lower":"2","upper":"2","ndv":1,"count":10,"pre_sum":0}]} -2 {"num_buckets":1,"buckets":[{"lower":"3","upper":"3","ndv":1,"count":10,"pre_sum":0}]} -3 {"num_buckets":1,"buckets":[{"lower":"4","upper":"4","ndv":1,"count":10,"pre_sum":0}]} -4 {"num_buckets":1,"buckets":[{"lower":"5","upper":"5","ndv":1,"count":10,"pre_sum":0}]} -5 {"num_buckets":1,"buckets":[{"lower":"6","upper":"6","ndv":1,"count":10,"pre_sum":0}]} -6 {"num_buckets":1,"buckets":[{"lower":"7","upper":"7","ndv":1,"count":10,"pre_sum":0}]} -7 {"num_buckets":1,"buckets":[{"lower":"8","upper":"8","ndv":1,"count":10,"pre_sum":0}]} -8 {"num_buckets":1,"buckets":[{"lower":"9","upper":"9","ndv":1,"count":10,"pre_sum":0}]} -9 {"num_buckets":1,"buckets":[{"lower":"10","upper":"10","ndv":1,"count":10,"pre_sum":0}]} -10 {"num_buckets":1,"buckets":[{"lower":"11","upper":"11","ndv":1,"count":10,"pre_sum":0}]} -11 {"num_buckets":1,"buckets":[{"lower":"12","upper":"12","ndv":1,"count":10,"pre_sum":0}]} +\N {"num_buckets":1,"buckets":[{"lower":"1","upper":"1","ndv":1,"count":1,"pre_sum":0}]} +0 {"num_buckets":1,"buckets":[{"lower":"1","upper":"1","ndv":1,"count":2,"pre_sum":0}]} +1 {"num_buckets":1,"buckets":[{"lower":"2","upper":"2","ndv":1,"count":2,"pre_sum":0}]} +2 {"num_buckets":1,"buckets":[{"lower":"3","upper":"3","ndv":1,"count":2,"pre_sum":0}]} +3 {"num_buckets":1,"buckets":[{"lower":"4","upper":"4","ndv":1,"count":2,"pre_sum":0}]} +4 {"num_buckets":1,"buckets":[{"lower":"5","upper":"5","ndv":1,"count":2,"pre_sum":0}]} +5 {"num_buckets":1,"buckets":[{"lower":"6","upper":"6","ndv":1,"count":2,"pre_sum":0}]} +6 {"num_buckets":1,"buckets":[{"lower":"7","upper":"7","ndv":1,"count":2,"pre_sum":0}]} +7 {"num_buckets":1,"buckets":[{"lower":"8","upper":"8","ndv":1,"count":2,"pre_sum":0}]} +8 {"num_buckets":1,"buckets":[{"lower":"9","upper":"9","ndv":1,"count":2,"pre_sum":0}]} +9 {"num_buckets":1,"buckets":[{"lower":"10","upper":"10","ndv":1,"count":2,"pre_sum":0}]} +10 {"num_buckets":1,"buckets":[{"lower":"11","upper":"11","ndv":1,"count":2,"pre_sum":0}]} +11 {"num_buckets":1,"buckets":[{"lower":"12","upper":"12","ndv":1,"count":2,"pre_sum":0}]} -- !select_max_by -- \N 1 @@ -1200,64 +1200,64 @@ 11 0.0 -- !select_sum0 -- -\N 5 -0 10 -1 20 -2 30 -3 40 -4 50 -5 60 -6 70 -7 80 -8 90 -9 100 -10 110 -11 120 +\N 1 +0 2 +1 4 +2 6 +3 8 +4 10 +5 12 +6 14 +7 16 +8 18 +9 20 +10 22 +11 24 -- !select_sum0_mv -- -\N 5 -0 10 -1 20 -2 30 -3 40 -4 50 -5 60 -6 70 -7 80 -8 90 -9 100 -10 110 -11 120 +\N 1 +0 2 +1 4 +2 6 +3 8 +4 10 +5 12 +6 14 +7 16 +8 18 +9 20 +10 22 +11 24 -- !select_topn -- -\N {"null":10,"varchar11":5} -0 {"varchar11":10} -1 {"varchar12":10} -2 {"varchar13":10} -3 {"varchar11":10} -4 {"varchar12":10} -5 {"varchar13":10} -6 {"varchar11":10} -7 {"varchar12":10} -8 {"varchar13":10} -9 {"varchar11":10} -10 {"varchar12":10} -11 {"varchar13":10} +\N {"null":2,"varchar11":1} +0 {"varchar11":2} +1 {"varchar12":2} +2 {"varchar13":2} +3 {"varchar11":2} +4 {"varchar12":2} +5 {"varchar13":2} +6 {"varchar11":2} +7 {"varchar12":2} +8 {"varchar13":2} +9 {"varchar11":2} +10 {"varchar12":2} +11 {"varchar13":2} -- !select_topn_mv -- -\N {"null":10,"varchar11":5} -0 {"varchar11":10} -1 {"varchar12":10} -2 {"varchar13":10} -3 {"varchar11":10} -4 {"varchar12":10} -5 {"varchar13":10} -6 {"varchar11":10} -7 {"varchar12":10} -8 {"varchar13":10} -9 {"varchar11":10} -10 {"varchar12":10} -11 {"varchar13":10} +\N {"null":2,"varchar11":1} +0 {"varchar11":2} +1 {"varchar12":2} +2 {"varchar13":2} +3 {"varchar11":2} +4 {"varchar12":2} +5 {"varchar13":2} +6 {"varchar11":2} +7 {"varchar12":2} +8 {"varchar13":2} +9 {"varchar11":2} +10 {"varchar12":2} +11 {"varchar13":2} -- !select_topn_array -- \N ["null", "varchar11"] diff --git a/regression-test/suites/nereids_syntax_p0/mv/aggregate/agg_sync_mv.groovy b/regression-test/suites/nereids_syntax_p0/mv/aggregate/agg_sync_mv.groovy index 2efe253db9e74ef..e547cf0fd30f2ab 100644 --- a/regression-test/suites/nereids_syntax_p0/mv/aggregate/agg_sync_mv.groovy +++ b/regression-test/suites/nereids_syntax_p0/mv/aggregate/agg_sync_mv.groovy @@ -25,10 +25,7 @@ suite("agg_sync_mv") { qt_select_any_value """select id, any_value(kint) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync1 on agg_mv_test;""" createMV("""create materialized view mv_sync1 as select id, any_value(kint) from agg_mv_test group by id order by id;""") - explain { - sql("select id, any_value(kint) from agg_mv_test group by id order by id;") - contains "(mv_sync1)" - } + mv_rewrite_success("select id, any_value(kint) from agg_mv_test group by id order by id;", "mv_sync1") qt_select_any_value_mv """select id, any_value(kint) from agg_mv_test group by id order by id;""" // sum_foreach is not supported in old planner @@ -50,308 +47,206 @@ suite("agg_sync_mv") { qt_select_collect_set """select id, collect_set(kint) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync4 on agg_mv_test;""" createMV("""create materialized view mv_sync4 as select id, collect_set(kint) from agg_mv_test group by id order by id;""") - explain { - sql("select id, collect_set(kint) from agg_mv_test group by id order by id;") - contains "(mv_sync4)" - } + mv_rewrite_success("select id, collect_set(kint) from agg_mv_test group by id order by id;", "mv_sync4") qt_select_collect_set_mv """select id, collect_set(kint) from agg_mv_test group by id order by id;""" qt_select_collect_list """select id, collect_list(kint) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync5 on agg_mv_test;""" createMV("""create materialized view mv_sync5 as select id, collect_list(kint) from agg_mv_test group by id order by id;""") - explain { - sql("select id, collect_list(kint) from agg_mv_test group by id order by id;") - contains "(mv_sync5)" - } + mv_rewrite_success("select id, collect_list(kint) from agg_mv_test group by id order by id;", "mv_sync5") qt_select_collect_list_mv """select id, collect_list(kint) from agg_mv_test group by id order by id;""" qt_select_corr """select id, corr(kint, kbint) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync6 on agg_mv_test;""" createMV("""create materialized view mv_sync6 as select id, corr(kint, kbint) from agg_mv_test group by id order by id;""") - explain { - sql("select id, corr(kint, kbint) from agg_mv_test group by id order by id;") - contains "(mv_sync6)" - } + mv_rewrite_success("select id, corr(kint, kbint) from agg_mv_test group by id order by id;", "mv_sync6") qt_select_corr_mv """select id, corr(kint, kbint) from agg_mv_test group by id order by id;""" qt_select_percentile_array """select id, percentile_array(kint, [0.5,0.55,0.805]) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync7 on agg_mv_test;""" createMV("""create materialized view mv_sync7 as select id, percentile_array(kint, [0.5,0.55,0.805]) from agg_mv_test group by id order by id;""") - explain { - sql("select id, percentile_array(kint, [0.5,0.55,0.805]) from agg_mv_test group by id order by id;") - contains "(mv_sync7)" - } + mv_rewrite_success("select id, percentile_array(kint, [0.5,0.55,0.805]) from agg_mv_test group by id order by id;", "mv_sync7") qt_select_percentile_array_mv """select id, percentile_array(kint, [0.5,0.55,0.805]) from agg_mv_test group by id order by id;""" qt_select_quantile_union """select id, quantile_union(to_quantile_state(kbint, 2048)) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync8 on agg_mv_test;""" createMV("""create materialized view mv_sync8 as select id, quantile_union(to_quantile_state(kbint, 2048)) from agg_mv_test group by id order by id;""") - explain { - sql("select id, quantile_union(to_quantile_state(kbint, 2048)) from agg_mv_test group by id order by id;") - contains "(mv_sync8)" - } + mv_rewrite_success("select id, quantile_union(to_quantile_state(kbint, 2048)) from agg_mv_test group by id order by id;", "mv_sync8") qt_select_quantile_union_mv """select id, quantile_union(to_quantile_state(kbint, 2048)) from agg_mv_test group by id order by id;""" qt_select_count_by_enum """select id, count_by_enum(kstr) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync9 on agg_mv_test;""" createMV("""create materialized view mv_sync9 as select id, count_by_enum(kstr) from agg_mv_test group by id order by id;""") - explain { - sql("select id, count_by_enum(kstr) from agg_mv_test group by id order by id;") - contains "(mv_sync9)" - } + mv_rewrite_success("select id, count_by_enum(kstr) from agg_mv_test group by id order by id;", "mv_sync9") qt_select_count_by_enum_mv """select id, count_by_enum(kstr) from agg_mv_test group by id order by id;""" qt_select_avg_weighted """select id, avg_weighted(ktint, kdbl) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync10 on agg_mv_test;""" createMV("""create materialized view mv_sync10 as select id, avg_weighted(ktint, kdbl) from agg_mv_test group by id order by id;""") - explain { - sql("select id, avg_weighted(ktint, kdbl) from agg_mv_test group by id order by id;") - contains "(mv_sync10)" - } + mv_rewrite_success("select id, avg_weighted(ktint, kdbl) from agg_mv_test group by id order by id;", "mv_sync10") qt_select_avg_weighted_mv """select id, avg_weighted(ktint, kdbl) from agg_mv_test group by id order by id;""" qt_select_bitmap_intersect """select id, bitmap_intersect(bitmap_hash(kbint)) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync11 on agg_mv_test;""" createMV("""create materialized view mv_sync11 as select id, bitmap_intersect(bitmap_hash(kbint)) from agg_mv_test group by id order by id;""") - explain { - sql("select id, bitmap_intersect(bitmap_hash(kbint)) from agg_mv_test group by id order by id;") - contains "(mv_sync11)" - } + mv_rewrite_success("select id, bitmap_intersect(bitmap_hash(kbint)) from agg_mv_test group by id order by id;", "mv_sync11") qt_select_bitmap_intersect_mv """select id, bitmap_intersect(bitmap_hash(kbint)) from agg_mv_test group by id order by id;""" qt_select_bitmap_agg """select id, bitmap_agg(kint) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync12 on agg_mv_test;""" createMV("""create materialized view mv_sync12 as select id, bitmap_agg(kint) from agg_mv_test group by id order by id;""") - explain { - sql("select id, bitmap_agg(kint) from agg_mv_test group by id order by id;") - contains "(mv_sync12)" - } + mv_rewrite_success("select id, bitmap_agg(kint) from agg_mv_test group by id order by id;", "mv_sync12") qt_select_bitmap_agg_mv """select id, bitmap_agg(kint) from agg_mv_test group by id order by id;""" qt_select_bitmap_union """select id, bitmap_union(bitmap_hash(kbint)) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync13 on agg_mv_test;""" createMV("""create materialized view mv_sync13 as select id, bitmap_union(bitmap_hash(kbint)) from agg_mv_test group by id order by id;""") - explain { - sql("select id, bitmap_union(bitmap_hash(kbint)) from agg_mv_test group by id order by id;") - contains "(mv_sync13)" - } + mv_rewrite_success("select id, bitmap_union(bitmap_hash(kbint)) from agg_mv_test group by id order by id;", "mv_sync13") qt_select_bitmap_union_mv """select id, bitmap_union(bitmap_hash(kbint)) from agg_mv_test group by id order by id;""" qt_select_bitmap_union_count """select id, bitmap_union_count(bitmap_hash(kbint)) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync14 on agg_mv_test;""" createMV("""create materialized view mv_sync14 as select id, bitmap_union_count(bitmap_hash(kbint)) from agg_mv_test group by id order by id;""") - explain { - sql("select id, bitmap_union_count(bitmap_hash(kbint)) from agg_mv_test group by id order by id;") - contains "(mv_sync14)" - } + mv_rewrite_success("select id, bitmap_union_count(bitmap_hash(kbint)) from agg_mv_test group by id order by id;", "mv_sync14") qt_select_bitmap_union_count_mv """select id, bitmap_union_count(bitmap_hash(kbint)) from agg_mv_test group by id order by id;""" qt_select_bitmap_union_int """select id, bitmap_union_int(kint) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync15 on agg_mv_test;""" createMV("""create materialized view mv_sync15 as select id, bitmap_union_int(kint) from agg_mv_test group by id order by id;""") - explain { - sql("select id, bitmap_union_int(kint) from agg_mv_test group by id order by id;") - contains "(mv_sync15)" - } + mv_rewrite_success("select id, bitmap_union_int(kint) from agg_mv_test group by id order by id;", "mv_sync15") qt_select_bitmap_union_int_mv """select id, bitmap_union_int(kint) from agg_mv_test group by id order by id;""" qt_select_group_array_intersect """select id, group_array_intersect(kaint) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync16 on agg_mv_test;""" createMV("""create materialized view mv_sync16 as select id, group_array_intersect(kaint) from agg_mv_test group by id order by id;""") - explain { - sql("select id, group_array_intersect(kaint) from agg_mv_test group by id order by id;") - contains "(mv_sync16)" - } + mv_rewrite_success("select id, group_array_intersect(kaint) from agg_mv_test group by id order by id;", "mv_sync16") qt_select_group_array_intersect_mv """select id, group_array_intersect(kaint) from agg_mv_test group by id order by id;""" qt_select_group_bit_and """select id, group_bit_and(kint) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync17 on agg_mv_test;""" createMV("""create materialized view mv_sync17 as select id, group_bit_and(kint) from agg_mv_test group by id order by id;""") - explain { - sql("select id, group_bit_and(kint) from agg_mv_test group by id order by id;") - contains "(mv_sync17)" - } + mv_rewrite_success("select id, group_bit_and(kint) from agg_mv_test group by id order by id;", "mv_sync17") qt_select_group_bit_and_mv """select id, group_bit_and(kint) from agg_mv_test group by id order by id;""" qt_select_group_bit_or """select id, group_bit_or(kint) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync18 on agg_mv_test;""" createMV("""create materialized view mv_sync18 as select id, group_bit_or(kint) from agg_mv_test group by id order by id;""") - explain { - sql("select id, group_bit_or(kint) from agg_mv_test group by id order by id;") - contains "(mv_sync18)" - } + mv_rewrite_success("select id, group_bit_or(kint) from agg_mv_test group by id order by id;", "mv_sync18") qt_select_group_bit_or_mv """select id, group_bit_or(kint) from agg_mv_test group by id order by id;""" qt_select_group_bit_xor """select id, group_bit_xor(kint) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync19 on agg_mv_test;""" createMV("""create materialized view mv_sync19 as select id, group_bit_xor(kint) from agg_mv_test group by id order by id;""") - explain { - sql("select id, group_bit_xor(kint) from agg_mv_test group by id order by id;") - contains "(mv_sync19)" - } + mv_rewrite_success("select id, group_bit_xor(kint) from agg_mv_test group by id order by id;", "mv_sync19") qt_select_group_bit_xor_mv """select id, group_bit_xor(kint) from agg_mv_test group by id order by id;""" qt_select_group_bitmap_xor """select id, group_bitmap_xor(bitmap_hash(kbint)) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync20 on agg_mv_test;""" createMV("""create materialized view mv_sync20 as select id, group_bitmap_xor(bitmap_hash(kbint)) from agg_mv_test group by id order by id;""") - explain { - sql("select id, group_bitmap_xor(bitmap_hash(kbint)) from agg_mv_test group by id order by id;") - contains "(mv_sync20)" - } + mv_rewrite_success("select id, group_bitmap_xor(bitmap_hash(kbint)) from agg_mv_test group by id order by id;", "mv_sync20") qt_select_group_bitmap_xor_mv """select id, group_bitmap_xor(bitmap_hash(kbint)) from agg_mv_test group by id order by id;""" qt_select_hll_union_agg """select id, hll_union_agg(hll_hash(kbint)) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync21 on agg_mv_test;""" createMV("""create materialized view mv_sync21 as select id, hll_union_agg(hll_hash(kbint)) from agg_mv_test group by id order by id;""") - explain { - sql("select id, hll_union_agg(hll_hash(kbint)) from agg_mv_test group by id order by id;") - contains "(mv_sync21)" - } + mv_rewrite_success("select id, hll_union_agg(hll_hash(kbint)) from agg_mv_test group by id order by id;", "mv_sync21") qt_select_hll_union_agg_mv """select id, hll_union_agg(hll_hash(kbint)) from agg_mv_test group by id order by id;""" qt_select_hll_union """select id, hll_union(hll_hash(kbint)) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync22 on agg_mv_test;""" createMV("""create materialized view mv_sync22 as select id, hll_union(hll_hash(kbint)) from agg_mv_test group by id order by id;""") - explain { - sql("select id, hll_union(hll_hash(kbint)) from agg_mv_test group by id order by id;") - contains "(mv_sync22)" - } + mv_rewrite_success("select id, hll_union(hll_hash(kbint)) from agg_mv_test group by id order by id;", "mv_sync22") qt_select_hll_union_mv """select id, hll_union(hll_hash(kbint)) from agg_mv_test group by id order by id;""" qt_select_intersect_count """select id, intersect_count(bitmap_hash(kbint), kint, 3, 4) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync23 on agg_mv_test;""" createMV("""create materialized view mv_sync23 as select id, intersect_count(bitmap_hash(kbint), kint, 3, 4) from agg_mv_test group by id order by id;""") - explain { - sql("select id, intersect_count(bitmap_hash(kbint), kint, 3, 4) from agg_mv_test group by id order by id;") - contains "(mv_sync23)" - } + mv_rewrite_success("select id, intersect_count(bitmap_hash(kbint), kint, 3, 4) from agg_mv_test group by id order by id;", "mv_sync23") qt_select_intersect_count_mv """select id, intersect_count(bitmap_hash(kbint), kint, 3, 4) from agg_mv_test group by id order by id;""" qt_select_group_concat """select id, group_concat(cast(abs(kint) as varchar)) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync24 on agg_mv_test;""" createMV("""create materialized view mv_sync24 as select id, group_concat(cast(abs(kint) as varchar)) from agg_mv_test group by id order by id;""") - explain { - sql("select id, group_concat(cast(abs(kint) as varchar)) from agg_mv_test group by id order by id;") - contains "(mv_sync24)" - } + mv_rewrite_success("select id, group_concat(cast(abs(kint) as varchar)) from agg_mv_test group by id order by id;", "mv_sync24") qt_select_group_concat_mv """select id, group_concat(cast(abs(kint) as varchar)) from agg_mv_test group by id order by id;""" qt_select_linear_histogram """select id, linear_histogram(kint, 10) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync on agg_mv_test;""" createMV("""create materialized view mv_sync as select id, linear_histogram(kint, 10) from agg_mv_test group by id order by id;""") - explain { - sql("select id, linear_histogram(kint, 10) from agg_mv_test group by id order by id;") - contains "(mv_sync)" - } + mv_rewrite_success("select id, linear_histogram(kint, 10) from agg_mv_test group by id order by id;", "mv_sync") qt_select_linear_histogram_mv """select id, linear_histogram(kint, 10) from agg_mv_test group by id order by id;""" qt_select_multi_distinct_group_concat """select id, multi_distinct_group_concat(cast(abs(kint) as varchar)) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync25 on agg_mv_test;""" createMV("""create materialized view mv_sync25 as select id, multi_distinct_group_concat(cast(abs(kint) as varchar)) from agg_mv_test group by id order by id;""") - explain { - sql("select id, multi_distinct_group_concat(cast(abs(kint) as varchar)) from agg_mv_test group by id order by id;") - contains "(mv_sync25)" - } + mv_rewrite_success("select id, multi_distinct_group_concat(cast(abs(kint) as varchar)) from agg_mv_test group by id order by id;", "mv_sync25") qt_select_multi_distinct_group_concat_mv """select id, multi_distinct_group_concat(cast(abs(kint) as varchar)) from agg_mv_test group by id order by id;""" qt_select_multi_distinct_sum0 """select id, multi_distinct_sum0(kint) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync26 on agg_mv_test;""" createMV("""create materialized view mv_sync26 as select id, multi_distinct_sum0(kint) from agg_mv_test group by id order by id;""") - explain { - sql("select id, multi_distinct_sum0(kint) from agg_mv_test group by id order by id;") - contains "(mv_sync26)" - } + mv_rewrite_success("select id, multi_distinct_sum0(kint) from agg_mv_test group by id order by id;", "mv_sync26") qt_select_multi_distinct_sum0_mv """select id, multi_distinct_sum0(kint) from agg_mv_test group by id order by id;""" qt_select_multi_distinct_sum """select id, multi_distinct_sum(kint) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync27 on agg_mv_test;""" createMV("""create materialized view mv_sync27 as select id, multi_distinct_sum(kint) from agg_mv_test group by id order by id;""") - explain { - sql("select id, multi_distinct_sum(kint) from agg_mv_test group by id order by id;") - contains "(mv_sync27)" - } + mv_rewrite_success("select id, multi_distinct_sum(kint) from agg_mv_test group by id order by id;", "mv_sync27") qt_select_multi_distinct_sum_mv """select id, multi_distinct_sum(kint) from agg_mv_test group by id order by id;""" qt_select_histogram """select id, histogram(kint) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync28 on agg_mv_test;""" createMV("""create materialized view mv_sync28 as select id, histogram(kint) from agg_mv_test group by id order by id;""") - explain { - sql("select id, histogram(kint) from agg_mv_test group by id order by id;") - contains "(mv_sync28)" - } + mv_rewrite_success("select id, histogram(kint) from agg_mv_test group by id order by id;", "mv_sync28") qt_select_histogram_mv """select id, histogram(kint) from agg_mv_test group by id order by id;""" qt_select_max_by """select id, max_by(kint, kint) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync29 on agg_mv_test;""" createMV("""create materialized view mv_sync29 as select id, max_by(kint, kint) from agg_mv_test group by id order by id;""") - explain { - sql("select id, max_by(kint, kint) from agg_mv_test group by id order by id;") - contains "(mv_sync29)" - } + mv_rewrite_success("select id, max_by(kint, kint) from agg_mv_test group by id order by id;", "mv_sync29") qt_select_max_by_mv """select id, max_by(kint, kint) from agg_mv_test group by id order by id;""" qt_select_min_by """select id, min_by(kint, kint) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync30 on agg_mv_test;""" createMV("""create materialized view mv_sync30 as select id, min_by(kint, kint) from agg_mv_test group by id order by id;""") - explain { - sql("select id, min_by(kint, kint) from agg_mv_test group by id order by id;") - contains "(mv_sync30)" - } + mv_rewrite_success("select id, min_by(kint, kint) from agg_mv_test group by id order by id;", "mv_sync30") qt_select_min_by_mv """select id, min_by(kint, kint) from agg_mv_test group by id order by id;""" qt_select_multi_distinct_count """select id, multi_distinct_count(kint) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync31 on agg_mv_test;""" createMV("""create materialized view mv_sync31 as select id, multi_distinct_count(kint) from agg_mv_test group by id order by id;""") - explain { - sql("select id, multi_distinct_count(kint) from agg_mv_test group by id order by id;") - contains "(mv_sync31)" - } + mv_rewrite_success("select id, multi_distinct_count(kint) from agg_mv_test group by id order by id;", "mv_sync31") qt_select_multi_distinct_count_mv """select id, multi_distinct_count(kint) from agg_mv_test group by id order by id;""" qt_select_ndv """select id, ndv(kint) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync32 on agg_mv_test;""" createMV("""create materialized view mv_sync32 as select id, ndv(kint) from agg_mv_test group by id order by id;""") - explain { - sql("select id, ndv(kint) from agg_mv_test group by id order by id;") - contains "(mv_sync32)" - } + mv_rewrite_success("select id, ndv(kint) from agg_mv_test group by id order by id;", "mv_sync32") qt_select_ndv_mv """select id, ndv(kint) from agg_mv_test group by id order by id;""" qt_select_covar """select id, covar(kint, kint) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync33 on agg_mv_test;""" createMV("""create materialized view mv_sync33 as select id, covar(kint, kint) from agg_mv_test group by id order by id;""") - explain { - sql("select id, covar(kint, kint) from agg_mv_test group by id order by id;") - contains "(mv_sync33)" - } + mv_rewrite_success("select id, covar(kint, kint) from agg_mv_test group by id order by id;", "mv_sync33") qt_select_covar_mv """select id, covar(kint, kint) from agg_mv_test group by id order by id;""" qt_select_covar_samp """select id, covar_samp(kint, kint) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync34 on agg_mv_test;""" createMV("""create materialized view mv_sync34 as select id, covar_samp(kint, kint) from agg_mv_test group by id order by id;""") - explain { - sql("select id, covar_samp(kint, kint) from agg_mv_test group by id order by id;") - contains "(mv_sync34)" - } + mv_rewrite_success("select id, covar_samp(kint, kint) from agg_mv_test group by id order by id;", "mv_sync34") qt_select_covar_samp_mv """select id, covar_samp(kint, kint) from agg_mv_test group by id order by id;""" qt_select_percentile """select id, percentile(kbint, 0.6) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync35 on agg_mv_test;""" createMV("""create materialized view mv_sync35 as select id, percentile(kbint, 0.6) from agg_mv_test group by id order by id;""") - explain { - sql("select id, percentile(kbint, 0.6) from agg_mv_test group by id order by id;") - contains "(mv_sync35)" - } + mv_rewrite_success("select id, percentile(kbint, 0.6) from agg_mv_test group by id order by id;", "mv_sync35") qt_select_percentile_mv """select id, percentile(kbint, 0.6) from agg_mv_test group by id order by id;""" qt_select_percentile_approx """select id, percentile_approx(kbint, 0.6) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync36 on agg_mv_test;""" createMV("""create materialized view mv_sync36 as select id, percentile_approx(kbint, 0.6) from agg_mv_test group by id order by id;""") - explain { - sql("select id, percentile_approx(kbint, 0.6) from agg_mv_test group by id order by id;") - contains "(mv_sync36)" - } + mv_rewrite_success("select id, percentile_approx(kbint, 0.6) from agg_mv_test group by id order by id;", "mv_sync36") qt_select_percentile_approx_mv """select id, percentile_approx(kbint, 0.6) from agg_mv_test group by id order by id;""" // percentile_approx_weighted is not supported in old planner @@ -367,156 +262,103 @@ suite("agg_sync_mv") { qt_select_sequence_count """select id, sequence_count('(?1)(?2)', kdtv2, kint = 1, kint = 2) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync38 on agg_mv_test;""" createMV("""create materialized view mv_sync38 as select id, sequence_count('(?1)(?2)', kdtv2, kint = 1, kint = 2) from agg_mv_test group by id order by id;""") - explain { - sql("select id, sequence_count('(?1)(?2)', kdtv2, kint = 1, kint = 2) from agg_mv_test group by id order by id;") - contains "(mv_sync38)" - } + mv_rewrite_success("select id, sequence_count('(?1)(?2)', kdtv2, kint = 1, kint = 2) from agg_mv_test group by id order by id;", "mv_sync38") qt_select_sequence_count_mv """select id, sequence_count('(?1)(?2)', kdtv2, kint = 1, kint = 2) from agg_mv_test group by id order by id;""" qt_select_sequence_match """select id, sequence_match('(?1)(?2)', kdtv2, kint = 1, kint = 2) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync39 on agg_mv_test;""" createMV("""create materialized view mv_sync39 as select id, sequence_match('(?1)(?2)', kdtv2, kint = 1, kint = 2) from agg_mv_test group by id order by id;""") - explain { - sql("select id, sequence_match('(?1)(?2)', kdtv2, kint = 1, kint = 2) from agg_mv_test group by id order by id;") - contains "(mv_sync39)" - } + mv_rewrite_success("select id, sequence_match('(?1)(?2)', kdtv2, kint = 1, kint = 2) from agg_mv_test group by id order by id;", "mv_sync39") qt_select_sequence_match_mv """select id, sequence_match('(?1)(?2)', kdtv2, kint = 1, kint = 2) from agg_mv_test group by id order by id;""" qt_select_stddev """select id, stddev(kint) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync40 on agg_mv_test;""" createMV("""create materialized view mv_sync40 as select id, stddev(kint) from agg_mv_test group by id order by id;""") - explain { - sql("select id, stddev(kint) from agg_mv_test group by id order by id;") - contains "(mv_sync40)" - } + mv_rewrite_success("select id, stddev(kint) from agg_mv_test group by id order by id;", "mv_sync40") qt_select_stddev_mv """select id, stddev(kint) from agg_mv_test group by id order by id;""" qt_select_stddev_pop """select id, stddev_pop(kint) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync41 on agg_mv_test;""" createMV("""create materialized view mv_sync41 as select id, stddev_pop(kint) from agg_mv_test group by id order by id;""") - explain { - sql("select id, stddev_pop(kint) from agg_mv_test group by id order by id;") - contains "(mv_sync41)" - } + mv_rewrite_success("select id, stddev_pop(kint) from agg_mv_test group by id order by id;", "mv_sync41") qt_select_stddev_pop_mv """select id, stddev_pop(kint) from agg_mv_test group by id order by id;""" qt_select_stddev_samp """select id, stddev_samp(kint) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync42 on agg_mv_test;""" createMV("""create materialized view mv_sync42 as select id, stddev_samp(kint) from agg_mv_test group by id order by id;""") - explain { - sql("select id, stddev_samp(kint) from agg_mv_test group by id order by id;") - contains "(mv_sync42)" - } + mv_rewrite_success("select id, stddev_samp(kint) from agg_mv_test group by id order by id;", "mv_sync42") qt_select_stddev_samp_mv """select id, stddev_samp(kint) from agg_mv_test group by id order by id;""" qt_select_sum0 """select id, sum0(kint) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync43 on agg_mv_test;""" createMV("""create materialized view mv_sync43 as select id, sum0(kint) from agg_mv_test group by id order by id;""") - explain { - sql("select id, sum0(kint) from agg_mv_test group by id order by id;") - contains "(mv_sync43)" - } + mv_rewrite_success("select id, sum0(kint) from agg_mv_test group by id order by id;", "mv_sync43") qt_select_sum0_mv """select id, sum0(kint) from agg_mv_test group by id order by id;""" qt_select_topn """select id, topn(kvchrs1, 3) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync44 on agg_mv_test;""" createMV("""create materialized view mv_sync44 as select id, topn(kvchrs1, 3) from agg_mv_test group by id order by id;""") - explain { - sql("select id, topn(kvchrs1, 3) from agg_mv_test group by id order by id;") - contains "(mv_sync44)" - } + mv_rewrite_success("select id, topn(kvchrs1, 3) from agg_mv_test group by id order by id;", "mv_sync44") qt_select_topn_mv """select id, topn(kvchrs1, 3) from agg_mv_test group by id order by id;""" qt_select_topn_array """select id, topn_array(kvchrs1, 3) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync45 on agg_mv_test;""" createMV("""create materialized view mv_sync45 as select id, topn_array(kvchrs1, 3) from agg_mv_test group by id order by id;""") - explain { - sql("select id, topn_array(kvchrs1, 3) from agg_mv_test group by id order by id;") - contains "(mv_sync45)" - } + mv_rewrite_success("select id, topn_array(kvchrs1, 3) from agg_mv_test group by id order by id;", "mv_sync45") qt_select_topn_array_mv """select id, topn_array(kvchrs1, 3) from agg_mv_test group by id order by id;""" qt_select_topn_weighted """select id, topn_weighted(kvchrs1, ktint, 3) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync46 on agg_mv_test;""" createMV("""create materialized view mv_sync46 as select id, topn_weighted(kvchrs1, ktint, 3) from agg_mv_test group by id order by id;""") - explain { - sql("select id, topn_weighted(kvchrs1, ktint, 3) from agg_mv_test group by id order by id;") - contains "(mv_sync46)" - } + mv_rewrite_success("select id, topn_weighted(kvchrs1, ktint, 3) from agg_mv_test group by id order by id;", "mv_sync46") qt_select_topn_weighted_mv """select id, topn_weighted(kvchrs1, ktint, 3) from agg_mv_test group by id order by id;""" qt_select_variance """select id, variance(kint) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync47 on agg_mv_test;""" createMV("""create materialized view mv_sync47 as select id, variance(kint) from agg_mv_test group by id order by id;""") - explain { - sql("select id, variance(kint) from agg_mv_test group by id order by id;") - contains "(mv_sync47)" - } + mv_rewrite_success("select id, variance(kint) from agg_mv_test group by id order by id;", "mv_sync47") qt_select_variance_mv """select id, variance(kint) from agg_mv_test group by id order by id;""" qt_select_var_pop """select id, var_pop(kint) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync48 on agg_mv_test;""" createMV("""create materialized view mv_sync48 as select id, var_pop(kint) from agg_mv_test group by id order by id;""") - explain { - sql("select id, var_pop(kint) from agg_mv_test group by id order by id;") - check { result -> - result.contains("(mv_sync47)") || result.contains("(mv_sync48)") - } - } + mv_rewrite_any_success("select id, var_pop(kint) from agg_mv_test group by id order by id;",["mv_sync47", "mv_sync48"]) qt_select_var_pop_mv """select id, var_pop(kint) from agg_mv_test group by id order by id;""" qt_select_variance_samp """select id, variance_samp(kint) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync49 on agg_mv_test;""" createMV("""create materialized view mv_sync49 as select id, variance_samp(kint) from agg_mv_test group by id order by id;""") - explain { - sql("select id, variance_samp(kint) from agg_mv_test group by id order by id;") - contains "(mv_sync49)" - } + mv_rewrite_success("select id, variance_samp(kint) from agg_mv_test group by id order by id;", "mv_sync49") qt_select_variance_samp_mv """select id, variance_samp(kint) from agg_mv_test group by id order by id;""" qt_select_var_samp """select id, var_samp(kint) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync50 on agg_mv_test;""" createMV("""create materialized view mv_sync50 as select id, var_samp(kint) from agg_mv_test group by id order by id;""") - explain { - sql("select id, var_samp(kint) from agg_mv_test group by id order by id;") - contains "(mv_sync50)" - } + mv_rewrite_success("select id, var_samp(kint) from agg_mv_test group by id order by id;", "mv_sync50") qt_select_var_samp_mv """select id, var_samp(kint) from agg_mv_test group by id order by id;""" qt_select_window_funnel """select id, window_funnel(3600 * 3, 'default', kdtm, kint = 1, kint = 2) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync51 on agg_mv_test;""" createMV("""create materialized view mv_sync51 as select id, window_funnel(3600 * 3, 'default', kdtm, kint = 1, kint = 2) from agg_mv_test group by id order by id;""") - explain { - sql("select id, window_funnel(3600 * 3, 'default', kdtm, kint = 1, kint = 2) from agg_mv_test group by id order by id;") - contains "(mv_sync51)" - } + mv_rewrite_success("select id, window_funnel(3600 * 3, 'default', kdtm, kint = 1, kint = 2) from agg_mv_test group by id order by id;", "mv_sync51") qt_select_window_funnel_mv """select id, window_funnel(3600 * 3, 'default', kdtm, kint = 1, kint = 2) from agg_mv_test group by id order by id;""" qt_select_map_agg """select id, map_agg(kint, kstr) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync52 on agg_mv_test;""" createMV("""create materialized view mv_sync52 as select id, map_agg(kint, kstr) from agg_mv_test group by id order by id;""") - explain { - sql("select id, map_agg(kint, kstr) from agg_mv_test group by id order by id;") - contains "(mv_sync52)" - } + mv_rewrite_success("select id, map_agg(kint, kstr) from agg_mv_test group by id order by id;", "mv_sync52") qt_select_map_agg_mv """select id, map_agg(kint, kstr) from agg_mv_test group by id order by id;""" qt_select_array_agg """select id, array_agg(kstr) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync53 on agg_mv_test;""" createMV("""create materialized view mv_sync53 as select id, array_agg(kstr) from agg_mv_test group by id order by id;""") - explain { - sql("select id, array_agg(kstr) from agg_mv_test group by id order by id;") - contains "(mv_sync53)" - } + mv_rewrite_success("select id, array_agg(kstr) from agg_mv_test group by id order by id;", "mv_sync53") qt_select_array_agg_mv """select id, array_agg(kstr) from agg_mv_test group by id order by id;""" qt_select_retention """select id, retention(kdtm = '2012-03-11', kdtm = '2012-03-12') from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync54 on agg_mv_test;""" createMV("""create materialized view mv_sync54 as select id, retention(kdtm = '2012-03-11', kdtm = '2012-03-12') from agg_mv_test group by id order by id;""") - explain { - sql("select id, retention(kdtm = '2012-03-11', kdtm = '2012-03-12') from agg_mv_test group by id order by id;") - contains "(mv_sync54)" - } + mv_rewrite_success("select id, retention(kdtm = '2012-03-11', kdtm = '2012-03-12') from agg_mv_test group by id order by id;", "mv_sync54") qt_select_retention_mv """select id, retention(kdtm = '2012-03-11', kdtm = '2012-03-12') from agg_mv_test group by id order by id;""" diff --git a/regression-test/suites/nereids_syntax_p1/mv/aggregate/agg_sync_mv.groovy b/regression-test/suites/nereids_syntax_p1/mv/aggregate/agg_sync_mv.groovy index 361ff9cc39981be..205acdf71dfca18 100644 --- a/regression-test/suites/nereids_syntax_p1/mv/aggregate/agg_sync_mv.groovy +++ b/regression-test/suites/nereids_syntax_p1/mv/aggregate/agg_sync_mv.groovy @@ -108,7 +108,7 @@ suite("agg_sync_mv") { qt_select_bitmap_union_count """select id, bitmap_union_count(bitmap_hash(kbint)) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync14 on agg_mv_test;""" createMV("""create materialized view mv_sync14 as select id, bitmap_union_count(bitmap_hash(kbint)) from agg_mv_test group by id order by id;""") - mv_rewrite_success("select id, bitmap_union_count(bitmap_hash(kbint)) from agg_mv_test group by id order by id;", "mv_sync14") + mv_rewrite_any_success("select id, bitmap_union_count(bitmap_hash(kbint)) from agg_mv_test group by id order by id;", ["mv_sync13", "mv_sync14"]) qt_select_bitmap_union_count_mv """select id, bitmap_union_count(bitmap_hash(kbint)) from agg_mv_test group by id order by id;""" qt_select_bitmap_union_int """select id, bitmap_union_int(kint) from agg_mv_test group by id order by id;""" @@ -275,7 +275,7 @@ suite("agg_sync_mv") { qt_select_stddev_pop """select id, stddev_pop(kint) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync41 on agg_mv_test;""" createMV("""create materialized view mv_sync41 as select id, stddev_pop(kint) from agg_mv_test group by id order by id;""") - mv_rewrite_success("select id, stddev_pop(kint) from agg_mv_test group by id order by id;", "mv_sync41") + mv_rewrite_any_success("select id, stddev_pop(kint) from agg_mv_test group by id order by id;", ["mv_sync40", "mv_sync41"]) qt_select_stddev_pop_mv """select id, stddev_pop(kint) from agg_mv_test group by id order by id;""" qt_select_stddev_samp """select id, stddev_samp(kint) from agg_mv_test group by id order by id;""" @@ -329,7 +329,7 @@ suite("agg_sync_mv") { qt_select_var_samp """select id, var_samp(kint) from agg_mv_test group by id order by id;""" sql """drop materialized view if exists mv_sync50 on agg_mv_test;""" createMV("""create materialized view mv_sync50 as select id, var_samp(kint) from agg_mv_test group by id order by id;""") - mv_rewrite_success("select id, var_samp(kint) from agg_mv_test group by id order by id;", "mv_sync50") + mv_rewrite_any_success("select id, var_samp(kint) from agg_mv_test group by id order by id;", ["mv_sync49", "mv_sync50"]) qt_select_var_samp_mv """select id, var_samp(kint) from agg_mv_test group by id order by id;""" qt_select_window_funnel """select id, window_funnel(3600 * 3, 'default', kdtm, kint = 1, kint = 2) from agg_mv_test group by id order by id;"""