diff --git a/regression-test/data/mtmv_p0/view/test_create_mtmv_contains_view.out b/regression-test/data/mtmv_p0/view/test_create_mtmv_contains_view.out index ee214bf1910a668..701a3aa59b356e9 100644 --- a/regression-test/data/mtmv_p0/view/test_create_mtmv_contains_view.out +++ b/regression-test/data/mtmv_p0/view/test_create_mtmv_contains_view.out @@ -19,3 +19,17 @@ 3 57.40 56.20 0 0 4 46.00 33.50 0 0 +-- !query4_before -- +2023-12-08 1 yy 1 \N 2 +2023-12-09 1 yy 2 2 2 +2023-12-10 1 yy 3 \N 2 +2023-12-11 2 mm 4 \N 1 +2023-12-12 2 mi 5 \N 2 + +-- !query4_after -- +2023-12-08 1 yy 1 \N 2 +2023-12-09 1 yy 2 2 2 +2023-12-10 1 yy 3 \N 2 +2023-12-11 2 mm 4 \N 1 +2023-12-12 2 mi 5 \N 2 + diff --git a/regression-test/suites/mtmv_p0/view/test_create_mtmv_contains_view.groovy b/regression-test/suites/mtmv_p0/view/test_create_mtmv_contains_view.groovy index e743410853ed112..e5d871b25813c18 100644 --- a/regression-test/suites/mtmv_p0/view/test_create_mtmv_contains_view.groovy +++ b/regression-test/suites/mtmv_p0/view/test_create_mtmv_contains_view.groovy @@ -82,7 +82,7 @@ suite("test_create_mtmv_contains_view","mtmv") { DISTRIBUTED BY HASH(l_orderkey) BUCKETS 3 PROPERTIES ( "replication_num" = "1" - ) + ); """ sql """ @@ -101,7 +101,7 @@ suite("test_create_mtmv_contains_view","mtmv") { DISTRIBUTED BY HASH(ps_partkey) BUCKETS 3 PROPERTIES ( "replication_num" = "1" - ) + ); """ sql """ insert into lineitem values @@ -149,7 +149,7 @@ suite("test_create_mtmv_contains_view","mtmv") { where o_orderdate = '2023-12-09' group by o_shippriority, - o_comment;; + o_comment; """ sql """ @@ -235,6 +235,46 @@ suite("test_create_mtmv_contains_view","mtmv") { sql """drop view if exists `${view3_name}`""" sql """drop materialized view if exists ${mv3_name};""" + + def mv4_name = 'mv1'; + def view4_name = 'view1'; + sql """drop view if exists `${view4_name}`""" + // basic test for mv contain view for rewrite + sql""" + create view ${view4_name} as + select * + from + orders left + join lineitem on l_orderkey = o_orderkey; + """ + + def mv4 = """ + SELECT * from ${view4_name}; + """ + def query4 = """ + select + o_orderdate, + o_shippriority, + o_comment, + l_orderkey, + ps_partkey, + count(*) + from + orders left + join lineitem on l_orderkey = o_orderkey + left join partsupp on ps_partkey = l_orderkey + group by + o_orderdate, + o_shippriority, + o_comment, + l_orderkey, + ps_partkey; + """ + order_qt_query4_before "${query4}" + check_mv_rewrite_success(db, mv4, query4, mv4_name) + order_qt_query4_after "${query4}" + sql """ DROP MATERIALIZED VIEW IF EXISTS ${mv4_name}""" + sql """ drop table if exists orders;""" sql """ drop table if exists lineitem;""" sql """ drop table if exists partsupp;"""