Skip to content

Commit d8e8959

Browse files
committed
remove copy
1 parent e4d315d commit d8e8959

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

sqlglot/optimizer/annotate_types.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,10 @@ def _get_scope_selects(self, scope: Scope) -> dict[str, dict[str, t.Any]]:
338338
inner_name = (
339339
pivot_source.name if isinstance(pivot_source, exp.Table) else pivot.alias
340340
)
341-
col_types = dict(selects.get(inner_name, {}))
342341

342+
source_types = selects.get(inner_name, {})
343+
344+
col_types = {}
343345
if pivot.unpivot:
344346
for field in pivot.fields:
345347
field_col = field.this
@@ -367,7 +369,7 @@ def _get_scope_selects(self, scope: Scope) -> dict[str, dict[str, t.Any]]:
367369
else [val_expr]
368370
)
369371
for val_col, src_col in zip(val_cols, src_cols):
370-
src_type = col_types.get(src_col.output_name) or src_col.type
372+
src_type = source_types.get(src_col.output_name) or src_col.type
371373
if isinstance(src_type, exp.DataType) and not src_type.is_type(
372374
exp.DType.UNKNOWN
373375
):

0 commit comments

Comments
 (0)