mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
fix: is_select with UNION (#25290)
This commit is contained in:
@@ -229,13 +229,17 @@ class ParsedQuery:
|
||||
:param oxide_parse: parsed CTE
|
||||
:return: True if CTE is a SELECT statement
|
||||
"""
|
||||
|
||||
def is_body_select(body: dict[str, Any]) -> bool:
|
||||
if op := body.get("SetOperation"):
|
||||
return is_body_select(op["left"]) and is_body_select(op["right"])
|
||||
return all(key == "Select" for key in body.keys())
|
||||
|
||||
for query in oxide_parse:
|
||||
parsed_query = query["Query"]
|
||||
cte_tables = self._get_cte_tables(parsed_query)
|
||||
for cte_table in cte_tables:
|
||||
is_select = all(
|
||||
key == "Select" for key in cte_table["query"]["body"].keys()
|
||||
)
|
||||
is_select = is_body_select(cte_table["query"]["body"])
|
||||
if not is_select:
|
||||
return False
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user