[fix](case)Fix multiple case tables with the same name causing case failure (#42203) (#43042)

pick: from master #42203
This commit is contained in:
zhangdong
2024-11-01 19:22:55 +08:00
committed by GitHub
parent cb25c40ddf
commit 3dcaa949e9
2 changed files with 14 additions and 10 deletions

View File

@ -21,6 +21,8 @@ suite("test_union") {
SET enable_fallback_to_original_planner=false;
set disable_nereids_rules='PRUNE_EMPTY_PARTITION';
"""
String suiteName = "nereids_union_test_union"
String viewName = "${suiteName}_view"
def db = "nereids_test_query_db"
sql "use ${db}"
@ -177,14 +179,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 `${db}`.`baseall` a LEFT OUTER JOIN
`${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

View File

@ -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}"
@ -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 `${db}`.`baseall` a LEFT OUTER JOIN
`${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