Repository navigation
feat(native): extract model references natively behind the preview engine - #1008
Merged
Merged
Conversation
kvlonge
enabled auto-merge (squash)
October 7, 2026 16:19
…call arguments Port Python's general reference extraction to sqlbuild-sqltext: every reference kind including __table_fn with its call-argument count, under each adapter's lexical rules, with Python's exact error messages for argument counts, empty arguments, malformed names and unclosed text. A non-ASCII character that decides the outcome, or an unsupported line comment prefix, defers the text to Python.
…gine Register reference extraction as a preview-tier native stage. Under native-preview every SQL text goes through the native scan, for every adapter's lexical rules; a deferral runs the Python scanner. A native error stands only when Python raises the same message, which is re-raised from Python; otherwise the compile fails with a NativeStageMismatchError instead of silently falling back. The python and native engines are unchanged. The lexical-syntax mapping for native scanners is shared through SqlLexicalSyntax.native_mapping and one binding input type.
The failure corpus gains reference cases: wrong argument counts, an empty argument, an expression name, unclosed calls, and table functions without an argument list, with a single-quoted name or with an empty call argument. A harness test compares a project with table functions and references hidden in comments, strings and dollar quotes under both engines.
kvlonge
force-pushed
the
feat/native-table-function-refs
branch
from
October 7, 2026 19:14
68b9609 to
6a28f13
Compare
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.
Why
The native reference fast path gives up on any
__table_fn(call and on dialect-specific text, so those SQL strings run the slow Python scanner. Table functions need the call-argument count and the exact Python errors, which the fast path never produced.Changes
sqlbuild-sqltextgains the general reference scan: every reference kind including__table_fnwith its call-argument count, under each adapter's lexical rules (#and//comments, nested comments, backslash, escape, raw and triple-quoted strings), with Python's exact error messages. A non-ASCII character that decides the outcome, or an unknown line-comment prefix, defers to Python.reference_extraction: onlynative-previewuses it.pythonandnativeare unchanged.NativeStageMismatchErrorinstead of silently falling back.SqlLexicalSyntax.native_mappingand one binding input type.Verification
make compiler-differentialwith captures and coverage (153 identical),make compiler-differential-shipped(147 identical),tests/e2e/scripts/compiler_differential, and dense 3k (2/2) all pass.cargo test,clippy,fmt,make check-native-layering,make check-ciandmake testpass.