Skip to content

Commit c23fd7d

Browse files
committed
fix
1 parent cad8db5 commit c23fd7d

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
@@ -360,8 +360,10 @@ def _get_scope_selects(self, scope: Scope) -> dict[str, dict[str, t.Any]]:
360360
else [val_expr]
361361
)
362362
for val_col, src_col in zip(val_cols, src_cols):
363-
src_type = col_types.get(src_col.output_name)
364-
if src_type:
363+
src_type = col_types.get(src_col.output_name) or src_col.type
364+
if isinstance(src_type, exp.DataType) and not src_type.is_type(
365+
exp.DType.UNKNOWN
366+
):
365367
col_types[val_col.output_name] = src_type
366368

367369
if col_types:

0 commit comments

Comments
 (0)