Skip to content

Commit 43dfe68

Browse files
committed
fix
1 parent cf10ba7 commit 43dfe68

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
@@ -369,8 +369,10 @@ def _get_scope_selects(self, scope: Scope) -> dict[str, dict[str, t.Any]]:
369369
else [val_expr]
370370
)
371371
for val_col, src_col in zip(val_cols, src_cols):
372-
src_type = col_types.get(src_col.output_name)
373-
if src_type:
372+
src_type = col_types.get(src_col.output_name) or src_col.type
373+
if isinstance(src_type, exp.DataType) and not src_type.is_type(
374+
exp.DType.UNKNOWN
375+
):
374376
col_types[val_col.output_name] = src_type
375377

376378
if col_types:

0 commit comments

Comments
 (0)