Skip to content

Commit 3fe5e29

Browse files
committed
simplify
1 parent 43dfe68 commit 3fe5e29

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
@@ -343,10 +343,11 @@ def _get_scope_selects(self, scope: Scope) -> dict[str, dict[str, t.Any]]:
343343
if pivot.unpivot:
344344
for field in pivot.fields:
345345
field_col = field.this
346-
if not isinstance(field_col, exp.Column) or not field.expressions:
346+
347+
first = seq_get(field.expressions, 0)
348+
if not first:
347349
continue
348350

349-
first = field.expressions[0]
350351
is_pivot_alias = isinstance(first, exp.PivotAlias)
351352

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

0 commit comments

Comments
 (0)