Skip to content

Commit e7fc838

Browse files
committed
remove copy
1 parent 242ea1a commit e7fc838

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
@@ -329,8 +329,10 @@ def _get_scope_selects(self, scope: Scope) -> dict[str, dict[str, t.Any]]:
329329
inner_name = (
330330
pivot_source.name if isinstance(pivot_source, exp.Table) else pivot.alias
331331
)
332-
col_types = dict(selects.get(inner_name, {}))
333332

333+
source_types = selects.get(inner_name, {})
334+
335+
col_types = {}
334336
if pivot.unpivot:
335337
for field in pivot.fields:
336338
field_col = field.this
@@ -358,7 +360,7 @@ def _get_scope_selects(self, scope: Scope) -> dict[str, dict[str, t.Any]]:
358360
else [val_expr]
359361
)
360362
for val_col, src_col in zip(val_cols, src_cols):
361-
src_type = col_types.get(src_col.output_name) or src_col.type
363+
src_type = source_types.get(src_col.output_name) or src_col.type
362364
if isinstance(src_type, exp.DataType) and not src_type.is_type(
363365
exp.DType.UNKNOWN
364366
):

0 commit comments

Comments
 (0)