diff --git a/regression-test/suites/nereids_rules_p0/mv/create_part_and_up/range_date_datetrunc_part_up.groovy b/regression-test/suites/nereids_rules_p0/mv/create_part_and_up/range_date_datetrunc_part_up.groovy index a1e28b2efd63f32..c86f5d6a141f7f3 100644 --- a/regression-test/suites/nereids_rules_p0/mv/create_part_and_up/range_date_datetrunc_part_up.groovy +++ b/regression-test/suites/nereids_rules_p0/mv/create_part_and_up/range_date_datetrunc_part_up.groovy @@ -124,20 +124,14 @@ suite("mtmv_range_date_datetrunc_date_part_up") { if (select_lists[i].replaceAll("`l_shipdate`", "").indexOf("l_shipdate") != -1) { create_mv(mv_name, str, "l_shipdate", "day") waitingMTMVTaskFinishedByMvName(mv_name) - explain { - sql("${str}") - contains "${mv_name}(${mv_name})" - } + mv_rewrite_success(str, mv_name) compare_res(str + " order by 1,2,3") } if (select_lists[i].indexOf("col1") != -1) { create_mv(mv_name, str, "col1", "day") waitingMTMVTaskFinishedByMvName(mv_name) - explain { - sql("${str}") - contains "${mv_name}(${mv_name})" - } + mv_rewrite_success(str, mv_name) compare_res(str + " order by 1,2,3") } diff --git a/regression-test/suites/nereids_rules_p0/mv/create_part_and_up/range_date_part_up_rewrite.groovy b/regression-test/suites/nereids_rules_p0/mv/create_part_and_up/range_date_part_up_rewrite.groovy index a2406dbe2f74fee..8bf629d93841fb9 100644 --- a/regression-test/suites/nereids_rules_p0/mv/create_part_and_up/range_date_part_up_rewrite.groovy +++ b/regression-test/suites/nereids_rules_p0/mv/create_part_and_up/range_date_part_up_rewrite.groovy @@ -166,10 +166,7 @@ suite("mtmv_range_date_part_up_rewrite") { for (int i = 0; i < mv_name_list.size(); i++) { def job_name = getJobName(db, mv_name_list[i]) waitingMTMVTaskFinished(job_name) - explain { - sql("${query_stmt_list[i]}") - contains "${mv_name_list[i]}(${mv_name_list[i]})" - } + mv_rewrite_success(query_stmt_list[i], mv_name_list[i]) compare_res(query_stmt_list[i] + " order by 1,2,3") } @@ -178,56 +175,38 @@ suite("mtmv_range_date_part_up_rewrite") { sql """insert into lineitem_range_date_union values (1, null, 3, 1, 5.5, 6.5, 7.5, 8.5, 'o', 'k', '2023-10-18', '2023-10-18', 'a', 'b', 'yyyyyyyyy', '2023-11-01')""" for (int i = 0; i < mv_name_list.size(); i++) { - explain { - sql("${query_stmt_list[i]}") - contains "${mv_name_list[i]}(${mv_name_list[i]})" - } + mv_rewrite_success(query_stmt_list[i], mv_name_list[i]) compare_res(query_stmt_list[i] + " order by 1,2,3") } for (int i = 0; i < mv_name_list.size(); i++) { sql """refresh MATERIALIZED VIEW ${mv_name_list[i]} auto;""" - explain { - sql("${query_stmt_list[i]}") - contains "${mv_name_list[i]}(${mv_name_list[i]})" - } + mv_rewrite_success(query_stmt_list[i], mv_name_list[i]) compare_res(query_stmt_list[i] + " order by 1,2,3") } sql """insert into lineitem_range_date_union values (2, null, 3, 1, 5.5, 6.5, 7.5, 8.5, 'o', 'k', '2023-10-18', '2023-10-18', 'a', 'b', 'yyyyyyyyy', '2023-11-01');""" for (int i = 0; i < mv_name_list.size(); i++) { - explain { - sql("${query_stmt_list[i]}") - contains "${mv_name_list[i]}(${mv_name_list[i]})" - } + mv_rewrite_success(query_stmt_list[i], mv_name_list[i]) compare_res(query_stmt_list[i] + " order by 1,2,3") } for (int i = 0; i < mv_name_list.size(); i++) { sql """refresh MATERIALIZED VIEW ${mv_name_list[i]} auto;""" - explain { - sql("${query_stmt_list[i]}") - contains "${mv_name_list[i]}(${mv_name_list[i]})" - } + mv_rewrite_success(query_stmt_list[i], mv_name_list[i]) compare_res(query_stmt_list[i] + " order by 1,2,3") } sql """ALTER TABLE lineitem_range_date_union DROP PARTITION IF EXISTS p4 FORCE""" for (int i = 0; i < mv_name_list.size(); i++) { - explain { - sql("${query_stmt_list[i]}") - contains "${mv_name_list[i]}(${mv_name_list[i]})" - } + mv_rewrite_success(query_stmt_list[i], mv_name_list[i]) compare_res(query_stmt_list[i] + " order by 1,2,3") } for (int i = 0; i < mv_name_list.size(); i++) { sql """refresh MATERIALIZED VIEW ${mv_name_list[i]} auto;""" - explain { - sql("${query_stmt_list[i]}") - contains "${mv_name_list[i]}(${mv_name_list[i]})" - } + mv_rewrite_success(query_stmt_list[i], mv_name_list[i]) compare_res(query_stmt_list[i] + " order by 1,2,3") } diff --git a/regression-test/suites/nereids_rules_p0/mv/create_part_and_up/range_datetime_part_up_rewrite.groovy b/regression-test/suites/nereids_rules_p0/mv/create_part_and_up/range_datetime_part_up_rewrite.groovy index 851879c9684a4a1..b7e9562249d7892 100644 --- a/regression-test/suites/nereids_rules_p0/mv/create_part_and_up/range_datetime_part_up_rewrite.groovy +++ b/regression-test/suites/nereids_rules_p0/mv/create_part_and_up/range_datetime_part_up_rewrite.groovy @@ -166,10 +166,7 @@ suite("mtmv_range_datetime_part_up_rewrite") { for (int i = 0; i < mv_name_list.size(); i++) { def job_name = getJobName(db, mv_name_list[i]) waitingMTMVTaskFinished(job_name) - explain { - sql("${query_stmt_list[i]}") - contains "${mv_name_list[i]}(${mv_name_list[i]})" - } + mv_rewrite_success(query_stmt_list[i], mv_name_list[i]) compare_res(query_stmt_list[i] + " order by 1,2,3") } @@ -178,56 +175,38 @@ suite("mtmv_range_datetime_part_up_rewrite") { sql """insert into lineitem_range_datetime_union values (1, null, 3, 1, 5.5, 6.5, 7.5, 8.5, 'o', 'k', '2023-10-18', '2023-10-18', 'a', 'b', 'yyyyyyyyy', '2023-11-29 03:00:00')""" for (int i = 0; i < mv_name_list.size(); i++) { - explain { - sql("${query_stmt_list[i]}") - contains "${mv_name_list[i]}(${mv_name_list[i]})" - } + mv_rewrite_success(query_stmt_list[i], mv_name_list[i]) compare_res(query_stmt_list[i] + " order by 1,2,3") } for (int i = 0; i < mv_name_list.size(); i++) { sql """refresh MATERIALIZED VIEW ${mv_name_list[i]} auto;""" - explain { - sql("${query_stmt_list[i]}") - contains "${mv_name_list[i]}(${mv_name_list[i]})" - } + mv_rewrite_success(query_stmt_list[i], mv_name_list[i]) compare_res(query_stmt_list[i] + " order by 1,2,3") } sql """insert into lineitem_range_datetime_union values (3, null, 3, 1, 5.5, 6.5, 7.5, 8.5, 'o', 'k', '2023-10-18', '2023-10-18', 'a', 'b', 'yyyyyyyyy', '2023-11-29 03:00:00');""" for (int i = 0; i < mv_name_list.size(); i++) { - explain { - sql("${query_stmt_list[i]}") - contains "${mv_name_list[i]}(${mv_name_list[i]})" - } + mv_rewrite_success(query_stmt_list[i], mv_name_list[i]) compare_res(query_stmt_list[i] + " order by 1,2,3") } for (int i = 0; i < mv_name_list.size(); i++) { sql """refresh MATERIALIZED VIEW ${mv_name_list[i]} auto;""" - explain { - sql("${query_stmt_list[i]}") - contains "${mv_name_list[i]}(${mv_name_list[i]})" - } + mv_rewrite_success(query_stmt_list[i], mv_name_list[i]) compare_res(query_stmt_list[i] + " order by 1,2,3") } sql """ALTER TABLE lineitem_range_datetime_union DROP PARTITION IF EXISTS p4 FORCE""" for (int i = 0; i < mv_name_list.size(); i++) { - explain { - sql("${query_stmt_list[i]}") - contains "${mv_name_list[i]}(${mv_name_list[i]})" - } + mv_rewrite_success(query_stmt_list[i], mv_name_list[i]) compare_res(query_stmt_list[i] + " order by 1,2,3") } for (int i = 0; i < mv_name_list.size(); i++) { sql """refresh MATERIALIZED VIEW ${mv_name_list[i]} auto;""" - explain { - sql("${query_stmt_list[i]}") - contains "${mv_name_list[i]}(${mv_name_list[i]})" - } + mv_rewrite_success(query_stmt_list[i], mv_name_list[i]) compare_res(query_stmt_list[i] + " order by 1,2,3") } diff --git a/regression-test/suites/nereids_rules_p0/mv/union_rewrite/partition_curd_union_rewrite.groovy b/regression-test/suites/nereids_rules_p0/mv/union_rewrite/partition_curd_union_rewrite.groovy index 8bc9ef4b30877f3..cbeb6768edec1af 100644 --- a/regression-test/suites/nereids_rules_p0/mv/union_rewrite/partition_curd_union_rewrite.groovy +++ b/regression-test/suites/nereids_rules_p0/mv/union_rewrite/partition_curd_union_rewrite.groovy @@ -177,15 +177,9 @@ suite ("partition_curd_union_rewrite") { """ // wait partition is invalid sleep(5000) - explain { - sql("${all_partition_sql}") - contains("${mv_name}(${mv_name})") - } + mv_rewrite_success(all_partition_sql, mv_name) compare_res(all_partition_sql + order_by_stmt) - explain { - sql("${partition_sql}") - contains("${mv_name}(${mv_name})") - } + mv_rewrite_success(partition_sql, mv_name) compare_res(partition_sql + order_by_stmt) sql "REFRESH MATERIALIZED VIEW ${mv_name} AUTO" @@ -197,15 +191,9 @@ suite ("partition_curd_union_rewrite") { """ // Wait partition is invalid sleep(5000) - explain { - sql("${all_partition_sql}") - contains("${mv_name}(${mv_name})") - } + mv_rewrite_success(all_partition_sql, mv_name) compare_res(all_partition_sql + order_by_stmt) - explain { - sql("${partition_sql}") - contains("${mv_name}(${mv_name})") - } + mv_rewrite_success(partition_sql, mv_name) compare_res(partition_sql + order_by_stmt) // Test when base table delete partition test @@ -215,14 +203,8 @@ suite ("partition_curd_union_rewrite") { """ // Wait partition is invalid sleep(3000) - explain { - sql("${all_partition_sql}") - contains("${mv_name}(${mv_name})") - } + mv_rewrite_success(all_partition_sql, mv_name) compare_res(all_partition_sql + order_by_stmt) - explain { - sql("${partition_sql}") - contains("${mv_name}(${mv_name})") - } + mv_rewrite_success(partition_sql, mv_name) compare_res(partition_sql + order_by_stmt) } diff --git a/regression-test/suites/nereids_rules_p0/mv/union_rewrite/partition_curd_union_rewrite_hive.groovy b/regression-test/suites/nereids_rules_p0/mv/union_rewrite/partition_curd_union_rewrite_hive.groovy index f74241bdbcf813f..14170bf21f40fa6 100644 --- a/regression-test/suites/nereids_rules_p0/mv/union_rewrite/partition_curd_union_rewrite_hive.groovy +++ b/regression-test/suites/nereids_rules_p0/mv/union_rewrite/partition_curd_union_rewrite_hive.groovy @@ -206,15 +206,9 @@ suite ("partition_curd_union_rewrite_hive") { waitingMTMVTaskFinished(getJobName(db, mv_name)) // All partition is valid, test query and rewrite by materialized view - explain { - sql("${all_partition_sql}") - contains("${mv_name}(${mv_name})") - } + mv_rewrite_success(all_partition_sql, mv_name) compare_res(all_partition_sql + order_by_stmt) - explain { - sql("${partition_sql}") - contains("${mv_name}(${mv_name})") - } + mv_rewrite_success(partition_sql, mv_name) compare_res(partition_sql + order_by_stmt) // Part partition is invalid, test can not use partition 2023-10-17 to rewrite @@ -224,30 +218,17 @@ suite ("partition_curd_union_rewrite_hive") { """ // wait partition is invalid sleep(5000) - explain { - sql("${all_partition_sql}") - contains("${mv_name}(${mv_name})") - } + mv_rewrite_success(all_partition_sql, mv_name) assertTrue(compare_res(all_partition_sql + order_by_stmt) == false) - explain { - sql("${partition_sql}") - contains("${mv_name}(${mv_name})") - } + mv_rewrite_success(partition_sql, mv_name) assertTrue(compare_res(all_partition_sql + order_by_stmt) == false) sql "REFRESH MATERIALIZED VIEW ${mv_name} AUTO" waitingMTMVTaskFinished(getJobName(db, mv_name)) - explain { - sql("${all_partition_sql}") - contains("${mv_name}(${mv_name})") - } + mv_rewrite_success(all_partition_sql, mv_name) compare_res(all_partition_sql + order_by_stmt) - - explain { - sql("${partition_sql}") - contains("${mv_name}(${mv_name})") - } + mv_rewrite_success(partition_sql, mv_name) compare_res(partition_sql + order_by_stmt) @@ -258,29 +239,17 @@ suite ("partition_curd_union_rewrite_hive") { """ // Wait partition is invalid sleep(5000) - explain { - sql("${all_partition_sql}") - contains("${mv_name}(${mv_name})") - } + mv_rewrite_success(all_partition_sql, mv_name) assertTrue(compare_res(all_partition_sql + order_by_stmt) == false) - explain { - sql("${partition_sql}") - contains("${mv_name}(${mv_name})") - } + mv_rewrite_success(partition_sql, mv_name) compare_res(partition_sql + order_by_stmt) // Test when base table delete partition test sql "REFRESH MATERIALIZED VIEW ${mv_name} AUTO" waitingMTMVTaskFinished(getJobName(db, mv_name)) - explain { - sql("${all_partition_sql}") - contains("${mv_name}(${mv_name})") - } + mv_rewrite_success(all_partition_sql, mv_name) compare_res(all_partition_sql + order_by_stmt) - explain { - sql("${partition_sql}") - contains("${mv_name}(${mv_name})") - } + mv_rewrite_success(partition_sql, mv_name) compare_res(partition_sql + order_by_stmt) }