Repository navigation
refactor(optimizer)!: defer scope annotation until qualification is complete - #8696
Open
georgesittas wants to merge 1 commit into
Open
georgesittas wants to merge 1 commit into
georgesittas wants to merge 1 commit into
Conversation
georgesittas
added this pull request to stack #8697
October 20, 2026 14:48
georgesittas
requested review from
VaggelisD and
geooo109
and
a balanced review from Copilot
October 20, 2026 14:53
Contributor
SQLGlot Integration Test Results✅ All tests passedComparing:
By Dialect
Overallmain: 182929 total, 165991 passed (pass rate: 90.7%) sqlglot:jo/annotator-06-deferred-annotation: 182929 total, 165998 passed (pass rate: 90.7%) Transitions: ✅ All tests passed |
georgesittas
force-pushed
the
jo/annotator-06-deferred-annotation
branch
from
October 20, 2026 15:35
cb78761 to
846420d
Compare
georgesittas
force-pushed
the
jo/annotator-06-deferred-annotation
branch
2 times, most recently
from
October 20, 2026 16:23
0a315ad to
1e17fba
Compare
georgesittas
force-pushed
the
jo/annotator-06-deferred-annotation
branch
from
October 20, 2026 16:24
1e17fba to
3c375d1
Compare
Comment on lines
+358
to
+368
| dependencies = itertools.chain( | ||
| current.cte_scopes, | ||
| current.set_operation_scopes, | ||
| current.table_scopes, | ||
| current.subquery_scopes, | ||
| ( | ||
| dependency | ||
| for name, _ in current.references | ||
| if isinstance(dependency := current.sources.get(name), Scope) | ||
| ), | ||
| ) |
Collaborator
There was a problem hiding this comment.
This is only triggered for RisingWane. BQ uses ANNOTATE_ALL_SCOPES = TRUE so it's fine.
georgesittas
force-pushed
the
jo/annotator-06-deferred-annotation
branch
2 times, most recently
from
October 20, 2026 19:43
4155507 to
00abb31
Compare
georgesittas
force-pushed
the
jo/annotator-06-deferred-annotation
branch
2 times, most recently
from
October 21, 2026 17:57
3556ce0 to
a79afbe
Compare
georgesittas
force-pushed
the
jo/annotator-06-deferred-annotation
branch
from
October 23, 2026 11:15
a79afbe to
24475be
Compare
georgesittas
force-pushed
the
jo/annotator-06-deferred-annotation
branch
from
October 23, 2026 11:29
24475be to
2af3a59
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

During qualification, annotate struct-star operands only when expansion needs their types. Resolve source dependencies iteratively so long CTE chains do not overflow. Defer whole-scope annotation until qualification is complete for dialects that require it, eliminating repeated cache invalidation.
Breaking change: removes
TypeAnnotator.uncache.