Skip to content

Commit

Permalink
add memo plan and disable fall back for problem location easier
Browse files Browse the repository at this point in the history
  • Loading branch information
seawinde committed Aug 22, 2024
1 parent 4ac783f commit be37c1f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,10 +243,7 @@ suite("partition_mv_rewrite_dimension_2_full_join") {
for (int j = 0; j < mv_list_1.size(); j++) {
logger.info("current index j:" + j)
if (j in [0, 2, 4, 5, 6, 8, 10, 11]) {
explain {
sql("${mv_list_1[j]}")
contains "${mv_name}(${mv_name})"
}
mv_rewrite_success(mv_list_1[j], mv_name)
compare_res(mv_list_1[j] + " order by 1,2,3,4,5")
} else {
explain {
Expand All @@ -259,10 +256,7 @@ suite("partition_mv_rewrite_dimension_2_full_join") {
for (int j = 0; j < mv_list_1.size(); j++) {
logger.info("j:" + j)
if (j in [1, 3, 4, 5, 7, 9, 10, 11]) {
explain {
sql("${mv_list_1[j]}")
contains "${mv_name}(${mv_name})"
}
mv_rewrite_success(mv_list_1[j], mv_name)
compare_res(mv_list_1[j] + " order by 1,2,3,4,5")
} else {
explain {
Expand All @@ -275,10 +269,7 @@ suite("partition_mv_rewrite_dimension_2_full_join") {
for (int j = 0; j < mv_list_1.size(); j++) {
logger.info("j:" + j)
if (j in [2, 4, 5, 8, 10, 11]) {
explain {
sql("${mv_list_1[j]}")
contains "${mv_name}(${mv_name})"
}
mv_rewrite_success(mv_list_1[j], mv_name)
compare_res(mv_list_1[j] + " order by 1,2,3,4,5")
} else {
explain {
Expand All @@ -291,10 +282,7 @@ suite("partition_mv_rewrite_dimension_2_full_join") {
for (int j = 0; j < mv_list_1.size(); j++) {
logger.info("j:" + j)
if (j in [3, 4, 5, 9, 10, 11]) {
explain {
sql("${mv_list_1[j]}")
contains "${mv_name}(${mv_name})"
}
mv_rewrite_success(mv_list_1[j], mv_name)
compare_res(mv_list_1[j] + " order by 1,2,3,4,5")
} else {
explain {
Expand All @@ -307,10 +295,7 @@ suite("partition_mv_rewrite_dimension_2_full_join") {
for (int j = 0; j < mv_list_1.size(); j++) {
logger.info("j:" + j)
if (j in [4, 5, 10, 11]) {
explain {
sql("${mv_list_1[j]}")
contains "${mv_name}(${mv_name})"
}
mv_rewrite_success(mv_list_1[j], mv_name)
compare_res(mv_list_1[j] + " order by 1,2,3,4,5")
} else {
explain {
Expand All @@ -323,10 +308,7 @@ suite("partition_mv_rewrite_dimension_2_full_join") {
for (int j = 0; j < mv_list_1.size(); j++) {
logger.info("j:" + j)
if (j in [5, 11]) {
explain {
sql("${mv_list_1[j]}")
contains "${mv_name}(${mv_name})"
}
mv_rewrite_success(mv_list_1[j], mv_name)
compare_res(mv_list_1[j] + " order by 1,2,3,4,5")
} else {
explain {
Expand All @@ -339,10 +321,7 @@ suite("partition_mv_rewrite_dimension_2_full_join") {
for (int j = 0; j < mv_list_1.size(); j++) {
logger.info("j:" + j)
if (j in [0, 2, 4, 5, 6, 8, 10, 11]) {
explain {
sql("${mv_list_1[j]}")
contains "${mv_name}(${mv_name})"
}
mv_rewrite_success(mv_list_1[j], mv_name)
compare_res(mv_list_1[j] + " order by 1,2,3,4,5")
} else {
explain {
Expand All @@ -355,10 +334,7 @@ suite("partition_mv_rewrite_dimension_2_full_join") {
for (int j = 0; j < mv_list_1.size(); j++) {
logger.info("j:" + j)
if (j in [1, 3, 4, 5, 7, 9, 10, 11]) {
explain {
sql("${mv_list_1[j]}")
contains "${mv_name}(${mv_name})"
}
mv_rewrite_success(mv_list_1[j], mv_name)
compare_res(mv_list_1[j] + " order by 1,2,3,4,5")
} else {
explain {
Expand All @@ -371,10 +347,7 @@ suite("partition_mv_rewrite_dimension_2_full_join") {
for (int j = 0; j < mv_list_1.size(); j++) {
logger.info("j:" + j)
if (j in [2, 4, 5, 8, 10, 11]) {
explain {
sql("${mv_list_1[j]}")
contains "${mv_name}(${mv_name})"
}
mv_rewrite_success(mv_list_1[j], mv_name)
compare_res(mv_list_1[j] + " order by 1,2,3,4,5")
} else {
explain {
Expand All @@ -387,10 +360,7 @@ suite("partition_mv_rewrite_dimension_2_full_join") {
for (int j = 0; j < mv_list_1.size(); j++) {
logger.info("j:" + j)
if (j in [3, 4, 5, 9, 10, 11]) {
explain {
sql("${mv_list_1[j]}")
contains "${mv_name}(${mv_name})"
}
mv_rewrite_success(mv_list_1[j], mv_name)
compare_res(mv_list_1[j] + " order by 1,2,3,4,5")
} else {
explain {
Expand All @@ -403,10 +373,7 @@ suite("partition_mv_rewrite_dimension_2_full_join") {
for (int j = 0; j < mv_list_1.size(); j++) {
logger.info("j:" + j)
if (j in [4, 5, 10, 11]) {
explain {
sql("${mv_list_1[j]}")
contains "${mv_name}(${mv_name})"
}
mv_rewrite_success(mv_list_1[j], mv_name)
compare_res(mv_list_1[j] + " order by 1,2,3,4,5")
} else {
explain {
Expand All @@ -419,10 +386,7 @@ suite("partition_mv_rewrite_dimension_2_full_join") {
for (int j = 0; j < mv_list_1.size(); j++) {
logger.info("j:" + j)
if (j in [5, 11]) {
explain {
sql("${mv_list_1[j]}")
contains "${mv_name}(${mv_name})"
}
mv_rewrite_success(mv_list_1[j], mv_name)
compare_res(mv_list_1[j] + " order by 1,2,3,4,5")
} else {
explain {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,48 +233,30 @@ suite("inner_join_infer_and_derive") {
for (int i = 0; i < query_list.size(); i++) {
logger.info("i: " + i)
if (i in [0, 2, 5, 6, 8, 11]) {
explain {
sql("${query_list[i]}")
notContains "${mv_name_1}(${mv_name_1})"
}
mv_rewrite_fail(query_list[i], mv_name_1)
} else {
explain {
sql("${query_list[i]}")
contains "${mv_name_1}(${mv_name_1})"
}
mv_rewrite_success(query_list[i], mv_name_1)
compare_res(query_list[i] + order_stmt)
}
}
} else if (mtmv_it == 1) {
for (int i = 0; i < query_list.size(); i++) {
logger.info("i: " + i)
if (i in [1, 3, 4, 7, 9, 10]) {
explain {
sql("${query_list[i]}")
notContains "${mv_name_1}(${mv_name_1})"
}
mv_rewrite_fail(query_list[i], mv_name_1)
} else {
explain {
sql("${query_list[i]}")
contains "${mv_name_1}(${mv_name_1})"
}
mv_rewrite_success(query_list[i], mv_name_1)
compare_res(query_list[i] + order_stmt)
}
}
} else if (mtmv_it == 2) {
for (int i = 0; i < query_list.size(); i++) {
logger.info("i: " + i)
if (i in [12, 13]) {
explain {
sql("${query_list[i]}")
contains "${mv_name_1}(${mv_name_1})"
}
mv_rewrite_success(query_list[i], mv_name_1)
compare_res(query_list[i] + order_stmt)
} else {
explain {
sql("${query_list[i]}")
notContains "${mv_name_1}(${mv_name_1})"
}
mv_rewrite_fail(query_list[i], mv_name_1)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ suite("test_upgrade_downgrade_compatibility_mtmv","p0,mtmv,restart_fe") {
}
}

// Reject fallback
sql """set enable_fallback_to_original_planner = false;"""

String mtmv_sql = """select l_Shipdate, o_Orderdate, l_partkey, l_suppkey
from ${lineitem_tb}
left join ${orders_tb}
Expand Down Expand Up @@ -110,11 +113,9 @@ suite("test_upgrade_downgrade_compatibility_mtmv","p0,mtmv,restart_fe") {
// drop
sql """DROP MATERIALIZED VIEW IF EXISTS ${mtmv_name};"""
sql """DROP TABLE IF EXISTS ${mtmv_name}"""

try {
test {
sql """select count(*) from ${mtmv_name}"""
} catch (Exception e) {
assertTrue(e.getMessage().contains("does not exist") || e.getMessage().contains("Unknown table"))
exception "does not exist"
}

// create
Expand Down

0 comments on commit be37c1f

Please sign in to comment.