Repository navigation
Group single-quoted literals with implicit aliases - #926
Draft
vhinayindia wants to merge 1 commit into
Draft
vhinayindia wants to merge 1 commit into
vhinayindia wants to merge 1 commit into
Conversation
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.
Fixes #518.
Single-quoted literals with an implicit alias are left outside the projection list. For example,
SELECT 'fixed_text' alias1, field1, field2 FROM tblaligns the following columns underalias1rather than under the complete first expression. A literal in the middle can split the projection into two lists.Include
String.Singlein the existing implicit-alias grouping pass, retaining its requirement that the next significant token is an Identifier. Bare and adjacent strings remain literal tokens, preserving #111's behavior. Numeric aliases continue to match all Number subtypes.The tests cover projection positions, nested SELECTs, empty/escaped/multiline strings, quoted aliases, parent links, round trips, and repeated reindent formatting. This is limited to single-quoted literal aliases; it does not extend prefixed or typed literals, comment-separated aliases, or dialect-specific alias grammar.
Validation on Linux:
Full suite on Python 3.10.21, 3.11.16, 3.12.14, 3.13.5 and 3.14.7: 533 passed, 2 xfailed, 1 xpassed on each. The xfail/xpass counts match untouched upstream.
Identical focused tests: 16 failed, 12 passed on untouched source; 28 passed with the fix.
make lintandgit diff --checkpass.The repository grouping benchmark and a bounded string-alias projection benchmark report linear scaling before and after.
Additional SQLite checks preserve result rows and column names across formatting; these do not establish behavior for every SQL dialect. Windows/macOS and hosted CI have not been run locally.
ran the tests (
pytest)all style issues addressed (
ruff)changes covered by tests
changelog updated; no public API changes