Skip to content

Commit

Permalink
[fix](case)Fix multiple case tables with the same name causing case f…
Browse files Browse the repository at this point in the history
…ailure (#42203) (#43043)

pick from master #42203
  • Loading branch information
zddr authored Nov 27, 2024
1 parent 90da61b commit 9cef7ec
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
12 changes: 7 additions & 5 deletions regression-test/suites/nereids_p0/union/test_union.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
suite("test_union") {
sql "SET enable_nereids_planner=true"
sql "SET enable_fallback_to_original_planner=false"
String suiteName = "nereids_union_test_union"
String viewName = "${suiteName}_view"
def db = "nereids_test_query_db"
sql "use ${db}"

Expand Down Expand Up @@ -174,14 +176,14 @@ suite("test_union") {
// test_union_bug
// PALO-3617
qt_union36 """select * from (select 1 as a, 2 as b union select 3, 3) c where a = 1"""
sql """drop view if exists nullable"""
sql """CREATE VIEW `nullable` AS SELECT `a`.`k1` AS `n1`, `b`.`k2` AS `n2`
sql """drop view if exists ${viewName}"""
sql """CREATE VIEW `${viewName}` AS SELECT `a`.`k1` AS `n1`, `b`.`k2` AS `n2`
FROM `default_cluster:${db}`.`baseall` a LEFT OUTER JOIN
`default_cluster:${db}`.`bigtable` b ON `a`.`k1` = `b`.`k1` + 10
WHERE `b`.`k2` IS NULL"""
order_qt_union37 """select n1 from nullable union all select n2 from nullable"""
qt_union38 """(select n1 from nullable) union all (select n2 from nullable order by n1) order by n1"""
qt_union39 """(select n1 from nullable) union all (select n2 from nullable) order by n1"""
order_qt_union37 """select n1 from ${viewName} union all select n2 from ${viewName}"""
qt_union38 """(select n1 from ${viewName}) union all (select n2 from ${viewName} order by n1) order by n1"""
qt_union39 """(select n1 from ${viewName}) union all (select n2 from ${viewName}) order by n1"""


// test_union_different_column
Expand Down
12 changes: 7 additions & 5 deletions regression-test/suites/query_p0/union/test_union.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
// under the License.

suite("test_union") {
String suiteName = "query_union_test_union"
String viewName = "${suiteName}_view"
def db = "test_query_db"
sql "use ${db}"

Expand Down Expand Up @@ -172,14 +174,14 @@ suite("test_union") {
// test_union_bug
// PALO-3617
qt_union36 """select * from (select 1 as a, 2 as b union select 3, 3) c where a = 1"""
sql """drop view if exists nullable"""
sql """CREATE VIEW `nullable` AS SELECT `a`.`k1` AS `n1`, `b`.`k2` AS `n2`
sql """drop view if exists ${viewName}"""
sql """CREATE VIEW `${viewName}` AS SELECT `a`.`k1` AS `n1`, `b`.`k2` AS `n2`
FROM `default_cluster:${db}`.`baseall` a LEFT OUTER JOIN
`default_cluster:${db}`.`bigtable` b ON `a`.`k1` = `b`.`k1` + 10
WHERE `b`.`k2` IS NULL"""
order_qt_union37 """select n1 from nullable union all select n2 from nullable"""
qt_union38 """(select n1 from nullable) union all (select n2 from nullable order by n1) order by n1"""
qt_union39 """(select n1 from nullable) union all (select n2 from nullable) order by n1"""
order_qt_union37 """select n1 from ${viewName} union all select n2 from ${viewName}"""
qt_union38 """(select n1 from ${viewName}) union all (select n2 from ${viewName} order by n1) order by n1"""
qt_union39 """(select n1 from ${viewName}) union all (select n2 from ${viewName}) order by n1"""


// test_union_different_column
Expand Down

0 comments on commit 9cef7ec

Please sign in to comment.