Skip to content

Commit dda7a20

Browse files
committed
simplify
1 parent c23fd7d commit dda7a20

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

sqlglot/optimizer/annotate_types.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,10 +334,11 @@ def _get_scope_selects(self, scope: Scope) -> dict[str, dict[str, t.Any]]:
334334
if pivot.unpivot:
335335
for field in pivot.fields:
336336
field_col = field.this
337-
if not isinstance(field_col, exp.Column) or not field.expressions:
337+
338+
first = seq_get(field.expressions, 0)
339+
if not first:
338340
continue
339341

340-
first = field.expressions[0]
341342
is_pivot_alias = isinstance(first, exp.PivotAlias)
342343

343344
# FOR column type from the alias literal, or VARCHAR if no alias

0 commit comments

Comments
 (0)