Skip to content

Commit 3ec5e35

Browse files
committed
clarify comment
1 parent 6fbe985 commit 3ec5e35

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

sqlglot/optimizer/qualify_columns.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,9 @@ def _qualify_columns(
669669
and isinstance(position := column.this.this, exp.Literal)
670670
and position.is_int
671671
):
672-
# Preserve references whose source shape cannot be resolved losslessly.
672+
# Pivots from unrelated sources may share this scope, so prefer an exact
673+
# output-alias match. For an aliasless chain, fall back to the last operator
674+
# on the referenced source.
673675
scope_pivot = next(
674676
(pivot for pivot in scope.pivots if pivot.alias == column_table), None
675677
)

0 commit comments

Comments
 (0)