diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-07-14 05:43:02 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-07-14 05:43:02 +0000 |
commit | c8d4d4ead5df1c84966431eec8b88e974414dafc (patch) | |
tree | 847e292ab98fe79a3a78cd6797b564b73f4d2681 /sqlglot/optimizer/pushdown_projections.py | |
parent | Releasing debian version 17.3.0-1. (diff) | |
download | sqlglot-c8d4d4ead5df1c84966431eec8b88e974414dafc.tar.xz sqlglot-c8d4d4ead5df1c84966431eec8b88e974414dafc.zip |
Merging upstream version 17.4.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sqlglot/optimizer/pushdown_projections.py')
-rw-r--r-- | sqlglot/optimizer/pushdown_projections.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sqlglot/optimizer/pushdown_projections.py b/sqlglot/optimizer/pushdown_projections.py index be3ddb2..97e8ff6 100644 --- a/sqlglot/optimizer/pushdown_projections.py +++ b/sqlglot/optimizer/pushdown_projections.py @@ -48,12 +48,12 @@ def pushdown_projections(expression, schema=None, remove_unused_selections=True) left, right = scope.union_scopes referenced_columns[left] = parent_selections - if any(select.is_star for select in right.selects): + if any(select.is_star for select in right.expression.selects): referenced_columns[right] = parent_selections - elif not any(select.is_star for select in left.selects): + elif not any(select.is_star for select in left.expression.selects): referenced_columns[right] = [ - right.selects[i].alias_or_name - for i, select in enumerate(left.selects) + right.expression.selects[i].alias_or_name + for i, select in enumerate(left.expression.selects) if SELECT_ALL in parent_selections or select.alias_or_name in parent_selections ] @@ -90,7 +90,7 @@ def _remove_unused_selections(scope, parent_selections, schema): removed = False star = False - for selection in scope.selects: + for selection in scope.expression.selects: name = selection.alias_or_name if SELECT_ALL in parent_selections or name in parent_selections or name in order_refs: |