diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-06-30 08:03:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-06-30 08:03:55 +0000 |
commit | 5510bab2f2724b1785efb5e4be0e4fa1e0afbf9e (patch) | |
tree | 8f11dc162604c83298116ce6ac23d64492e2c189 /sqlglot/transforms.py | |
parent | Adding upstream version 16.7.3. (diff) | |
download | sqlglot-5510bab2f2724b1785efb5e4be0e4fa1e0afbf9e.tar.xz sqlglot-5510bab2f2724b1785efb5e4be0e4fa1e0afbf9e.zip |
Adding upstream version 16.7.7.upstream/16.7.7
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sqlglot/transforms.py')
-rw-r--r-- | sqlglot/transforms.py | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/sqlglot/transforms.py b/sqlglot/transforms.py index 1f30f96..33a1bc0 100644 --- a/sqlglot/transforms.py +++ b/sqlglot/transforms.py @@ -157,14 +157,10 @@ def unnest_to_explode(expression: exp.Expression) -> exp.Expression: def explode_to_unnest(expression: exp.Expression) -> exp.Expression: """Convert explode/posexplode into unnest (used in hive -> presto).""" if isinstance(expression, exp.Select): - from sqlglot.optimizer.scope import build_scope - - scope = build_scope(expression) - if not scope: - return expression + from sqlglot.optimizer.scope import Scope taken_select_names = set(expression.named_selects) - taken_source_names = set(scope.selected_sources) + taken_source_names = {name for name, _ in Scope(expression).references} for select in expression.selects: to_replace = select |