fix(bigquery): parse digit-leading field names after a dot - #8182
Open
DSeaStar wants to merge 1 commit into
Open
fix(bigquery): parse digit-leading field names after a dot#8182DSeaStar wants to merge 1 commit into
DSeaStar wants to merge 1 commit into
Conversation
BigQuery allows JSON/STRUCT keys like 144A_FLAG. The tokenizer splits that into NUMBER + VAR, and the column path treated the suffix as an alias (data.144 AS A_FLAG). Glue the connected tokens after a DOT the same way table parts already do for names like foo.bar.25x. Fixes tobymao#8175
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.
SELECT data.144A_FLAG FROM twas tokenized as NUMBER144+ VARA_FLAGand then parsed asdata.144 AS A_FLAG. BigQuery allows those digit-leading JSON/STRUCT keys (confirmed with a dry run in #8175)._parse_table_partalready glues a connected NUMBER+VAR after a dot (foo.bar.25x). Do the same in_parse_fieldso column/field access gets a quoted identifier instead of an implicit alias.Fixes #8175
I used Grok (Cursor) while writing this. I confirmed the mis-parse on main, matched the existing table-part glue, and ran
tests/dialects/test_bigquery.py(58 tests).