Skip to content

Commit dee01a9

Browse files
committed
revert copy
1 parent d8e8959 commit dee01a9

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

sqlglot/optimizer/annotate_types.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,8 @@ def _get_scope_selects(self, scope: Scope) -> dict[str, dict[str, t.Any]]:
339339
pivot_source.name if isinstance(pivot_source, exp.Table) else pivot.alias
340340
)
341341

342-
source_types = selects.get(inner_name, {})
342+
col_types = selects.get(inner_name, {}).copy()
343343

344-
col_types = {}
345344
if pivot.unpivot:
346345
for field in pivot.fields:
347346
field_col = field.this
@@ -369,7 +368,7 @@ def _get_scope_selects(self, scope: Scope) -> dict[str, dict[str, t.Any]]:
369368
else [val_expr]
370369
)
371370
for val_col, src_col in zip(val_cols, src_cols):
372-
src_type = source_types.get(src_col.output_name) or src_col.type
371+
src_type = col_types.get(src_col.output_name) or src_col.type
373372
if isinstance(src_type, exp.DataType) and not src_type.is_type(
374373
exp.DType.UNKNOWN
375374
):

0 commit comments

Comments
 (0)