Repository navigation
BigQuery: Allow tokens after a hyphenated identifier ending in a number - #2620
Open
LucaCappelletti94 wants to merge 2 commits into
Open
LucaCappelletti94 wants to merge 2 commits into
LucaCappelletti94 wants to merge 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2620 +/- ##
==========================================
+ Coverage 81.24% 81.31% +0.06%
==========================================
Files 42 42
Lines 33901 33977 +76
Branches 33901 33977 +76
==========================================
+ Hits 27543 27628 +85
+ Misses 2792 2785 -7
+ Partials 3566 3564 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
LucaCappelletti94
force-pushed
the
bigquery-hyphen-numeric-boundary
branch
from
October 8, 2026 19:23
127a284 to
e739b34
Compare
LucaCappelletti94
force-pushed
the
bigquery-hyphen-numeric-boundary
branch
from
October 17, 2026 15:00
e739b34 to
66c2776
Compare
s5dsn-eqee
suggested changes
Oct 20, 2026
s5dsn-eqee
left a comment
Contributor
There was a problem hiding this comment.
Looks good. Please add a few more tests and a fuzz seed.
Test example:
// Punctuation butted onto the trailing number is fine.
bigquery().one_statement_parses_to("SELECT * FROM foo-1;", "SELECT * FROM foo-1");
bigquery().verified_stmt("SELECT * FROM (SELECT 1 FROM foo-1)");
bigquery().one_statement_parses_to("CREATE TABLE t-1(a INT64)", "CREATE TABLE t-1 (a INT64)");
// A quoted word glued onto the number is rejected like a bare word.
let err = bigquery()
.parse_sql_statements("SELECT * FROM foo-1`x`")
.unwrap_err();
assert_eq!(
ParserError::ParserError(
"Expected: whitespace following hyphenated identifier, found: `x`".to_string(),
),
err
);| if requires_whitespace { | ||
| let token = self.next_token(); | ||
| if !matches!(token.token, Token::EOF | Token::Whitespace(_)) { | ||
| let token = self.peek_token_no_skip(); |
Contributor
Author
|
Added the tests and seed |
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.
A BigQuery identifier without quotes that ends in a number, such as
foo-123, had to be followed by whitespace or end of input.SELECT * FROM foo-1, bar-2therefore failed withwhitespace following hyphenated identifier, even though the comma is clearly not part of the name. The parser now peeks at the next token instead of consuming it and only rejects a word or number butted directly onto the trailing number, the case that would glue into the identifier as infoo-123aand is still rejected. Any other token, such as a comma, parenthesis, or keyword, may now follow the numeric segment.