Skip to content

fix: type-check star-sourced columns without full requalification - #28

Merged
kvlonge merged 2 commits into
mainfrom
fix/star-sourced-type-checks
Sep 27, 2026
Merged

kvlonge merged 2 commits into
mainfrom
fix/star-sourced-type-checks

Conversation

@kvlonge

@kvlonge kvlonge commented Sep 26, 2026

Copy link
Copy Markdown

Why

Type validation requalified the whole statement only when it contained both a set operation and a star. That second qualification dominated validation time on large set-operation projects, and identical queries without a set operation got no star-sourced column types, so their type conflicts were silently unchecked.

Changes

  • For every statement with a projection star, expand CTE and source stars with the ordered lineage expansion used by analysis.
  • Fall back to full qualification only when a star remains unresolved (e.g. over a derived table).
  • Regression test covering CTE, chained-CTE and derived-table stars without set operations, plus a no-false-positive case.
  • Version 0.13.5.

Verification

  • cargo test --lib -p polyglot-sql: 1340 passed.
  • Downstream: a 3,000-model synthetic project's validation time fell from ~11.5 s to ~6.9 s with identical diagnostics; a large project gained only correct star-sourced findings, with all previous findings retained.

Validation previously requalified the whole statement only when it
contained both a set operation and a star. That was expensive for large
set-operation projects and left identical queries without a set
operation unchecked for star-sourced column types.

Expand CTE and source stars with the ordered lineage expansion for every
statement with a projection star, and fall back to full qualification
only when a star remains unresolved (for example over a derived table).
Bump the version to 0.13.5.
@kvlonge
kvlonge merged commit 148465f into main Sep 27, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant