Merging upstream version 26.2.1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
a5399bd16b
commit
4d0635d636
85 changed files with 57142 additions and 52288 deletions
|
@ -146,9 +146,7 @@ class Scope:
|
|||
self._udtfs.append(node)
|
||||
elif isinstance(node, exp.CTE):
|
||||
self._ctes.append(node)
|
||||
elif _is_derived_table(node) and isinstance(
|
||||
node.parent, (exp.From, exp.Join, exp.Subquery)
|
||||
):
|
||||
elif _is_derived_table(node) and _is_from_or_join(node):
|
||||
self._derived_tables.append(node)
|
||||
elif isinstance(node, exp.UNWRAPPED_QUERIES):
|
||||
self._subqueries.append(node)
|
||||
|
@ -661,6 +659,19 @@ def _is_derived_table(expression: exp.Subquery) -> bool:
|
|||
)
|
||||
|
||||
|
||||
def _is_from_or_join(expression: exp.Expression) -> bool:
|
||||
"""
|
||||
Determine if `expression` is the FROM or JOIN clause of a SELECT statement.
|
||||
"""
|
||||
parent = expression.parent
|
||||
|
||||
# Subqueries can be arbitrarily nested
|
||||
while isinstance(parent, exp.Subquery):
|
||||
parent = parent.parent
|
||||
|
||||
return isinstance(parent, (exp.From, exp.Join))
|
||||
|
||||
|
||||
def _traverse_tables(scope):
|
||||
sources = {}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue