Skip to content

fix(bigquery): parse digit-leading field names after a dot - #8182

Open
DSeaStar wants to merge 1 commit into
tobymao:mainfrom
DSeaStar:fix/bigquery-digit-leading-fields
Open

fix(bigquery): parse digit-leading field names after a dot#8182
DSeaStar wants to merge 1 commit into
tobymao:mainfrom
DSeaStar:fix/bigquery-digit-leading-fields

Conversation

@DSeaStar

Copy link
Copy Markdown

SELECT data.144A_FLAG FROM t was tokenized as NUMBER 144 + VAR A_FLAG and then parsed as data.144 AS A_FLAG. BigQuery allows those digit-leading JSON/STRUCT keys (confirmed with a dry run in #8175).

_parse_table_part already glues a connected NUMBER+VAR after a dot (foo.bar.25x). Do the same in _parse_field so 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).

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
@DSeaStar DSeaStar changed the title fix(bigquery): parse digit-leading field names after a dot [GROK] fix(bigquery): parse digit-leading field names after a dot Aug 14, 2026
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.

BigQuery: data.144A_FLAG silently mis-parses to data.144 AS A_FLAG; compiled build raises bare TypeError

1 participant