You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datafusion.apache.org by lu...@apache.org on 2026/10/21 07:30:16 UTC
(datafusion-sqlparser-rs) branch bigquery-hyphen-numeric-boundary updated (099818a92 -> b9a5c362c)
This is an automated email from the ASF dual-hosted git repository.
LucaCappelletti94 pushed a change to branch bigquery-hyphen-numeric-boundary
in repository https://gitbox.apache.org/repos/asf/datafusion-sqlparser-rs.git
omit 099818a92 Cover BigQuery hyphenated table boundaries
omit 66c2776d6 BigQuery: Allow tokens after a hyphenated identifier ending in a number
add 1aabd12d1 Add `Dialect::supports_cte_materialization` and enable it for DuckDB (#2651)
add 63015f54e ClickHouse, MySQL: Keep the quoting of the CREATE TABLE ENGINE name (#2655)
add 4ad878405 SQLite: Support a parenthesized table name in `FROM` (#2658)
add 66e0e8985 PostgreSQL: Reject string literals as aliases (#2668)
add 8977e96a9 Deny `clippy::dbg_macro and clippy::todo` (#2654)
add ada831442 DuckDB: Always render the macro argument list parentheses (#2656)
add d32825d6f replaces the hard-coded dialect list in the tokenizer with a `supports_hash_comment` dialect method (#2674)
add d08caecfe Docs: Require a fuzz seed per bug fix in AGENTS.md (#2690)
add 9168946a6 ClickHouse: Allow $ inside identifiers (#2686)
add 3330dc9e7 Check prefix operator spacing by rendered first char (#2577)
add 68e626d16 Snowflake: Support ALTER TABLE ADD COLUMN IF NOT EXISTS (#2639)
add fad68134e SQLite: Accept a block comment left open at end of input (#2661)
add f937b73ef PostgreSQL: Parse an empty SELECT target list without FROM (#2675)
add 122882891 PostgreSQL, SQLite, DuckDB, MySQL: Accept keyword-like base window names in `OVER` (#2672)
add 3d27cf74f Add `Comments::find_before` (#2691)
add 7bc304cd5 SQLite: Parse `&` and `|` at the same precedence (#2683)
add 1ea2488a6 CI: Remove ClusterFuzzLite from PR, daily schedule only. (#2697)
add d4e2b2837 PostgreSQL: Parse custom typed string literals (#2689)
add b79a5ab19 PostgreSQL: Parse schema-qualified keyword function calls (#2685)
add eda940d40 Refactoring: Merge the `IN` expression variants into `Expr::In` (#2679)
add 9cacf35ee MsSql: Keep the comma separator when displaying DECLARE lists (#2671)
add 424378c2c DuckDB, MySQL, Spark, Databricks, Hive, ClickHouse: Accept string literal aliases only where each engine does (#2669)
new 3ede09465 BigQuery: Allow tokens after a hyphenated identifier ending in a number
new b9a5c362c Cover BigQuery hyphenated table boundaries
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (099818a92)
\
N -- N -- N refs/heads/bigquery-hyphen-numeric-boundary (b9a5c362c)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.github/workflows/cflite_pr.yml | 48 ---
AGENTS.md | 1 +
Cargo.toml | 2 +
docs/fuzzing.md | 4 +-
.../clickhouse_2686_dollar_identifier.sql | 1 +
fuzz/fuzz_seeds/clickhouse_hash_comment.sql | 48 +++
src/ast/comments.rs | 122 +++++-
src/ast/mod.rs | 141 ++++---
src/ast/spans.rs | 49 ++-
src/dialect/bigquery.rs | 9 +
src/dialect/clickhouse.rs | 25 +-
src/dialect/databricks.rs | 13 +
src/dialect/duckdb.rs | 17 +
src/dialect/generic.rs | 4 +
src/dialect/hive.rs | 16 +
src/dialect/mod.rs | 64 +++-
src/dialect/mysql.rs | 10 +
src/dialect/postgresql.rs | 185 +++++++++
src/dialect/snowflake.rs | 9 +
src/dialect/spark.rs | 12 +
src/dialect/sqlite.rs | 20 +-
src/display_utils.rs | 55 +++
src/parser/mod.rs | 250 +++++++-----
src/tokenizer.rs | 21 +-
tests/sqlparser_bigquery.rs | 2 +-
tests/sqlparser_clickhouse.rs | 46 ++-
tests/sqlparser_comments.rs | 121 +++++-
tests/sqlparser_common.rs | 425 +++++++++++++++++++--
tests/sqlparser_duckdb.rs | 37 ++
tests/sqlparser_mssql.rs | 13 +-
tests/sqlparser_mysql.rs | 6 +
tests/sqlparser_postgres.rs | 93 +++++
tests/sqlparser_snowflake.rs | 10 +-
tests/sqlparser_sqlite.rs | 106 ++++-
34 files changed, 1683 insertions(+), 302 deletions(-)
delete mode 100644 .github/workflows/cflite_pr.yml
create mode 100644 fuzz/fuzz_seeds/clickhouse_2686_dollar_identifier.sql
create mode 100644 fuzz/fuzz_seeds/clickhouse_hash_comment.sql
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org
(datafusion-sqlparser-rs) 01/02: BigQuery: Allow tokens after a hyphenated identifier ending in a number
Posted by lu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
LucaCappelletti94 pushed a commit to branch bigquery-hyphen-numeric-boundary
in repository https://gitbox.apache.org/repos/asf/datafusion-sqlparser-rs.git
commit 3ede094651db4e993578c0f1d1f5101fa60eb855
Author: LucaCappelletti94 <ca...@gmail.com>
AuthorDate: Wed Sep 23 02:03:29 2026 +0200
BigQuery: Allow tokens after a hyphenated identifier ending in a number
---
src/parser/mod.rs | 7 +++----
tests/sqlparser_bigquery.rs | 22 ++++++++++++++++++++++
2 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/src/parser/mod.rs b/src/parser/mod.rs
index 276b252ed..0b65b5e23 100644
--- a/src/parser/mod.rs
+++ b/src/parser/mod.rs
@@ -14241,11 +14241,10 @@ impl<'a> Parser<'a> {
}
}
- // If the last segment was a number, we must check that it's followed by whitespace,
- // otherwise foo-123a will be parsed as `foo-123` with the alias `a`.
+ // A word or number butted onto a trailing number glues into it, as in `foo-123a`.
if requires_whitespace {
- let token = self.next_token();
- if !matches!(token.token, Token::EOF | Token::Whitespace(_)) {
+ let token = self.peek_token_no_skip();
+ if matches!(token.token, Token::Word(_) | Token::Number(_, false)) {
return self
.expected("whitespace following hyphenated identifier", token);
}
diff --git a/tests/sqlparser_bigquery.rs b/tests/sqlparser_bigquery.rs
index 612d3c2b0..d847fe0f9 100644
--- a/tests/sqlparser_bigquery.rs
+++ b/tests/sqlparser_bigquery.rs
@@ -3001,3 +3001,25 @@ fn test_byte_and_raw_string_quote_escaping() {
err
);
}
+
+#[test]
+fn parse_hyphenated_identifier_after_numeric_segment() {
+ bigquery().verified_stmt("SELECT * FROM project-1.dataset-2.table-3 WHERE x = 1");
+ bigquery().verified_stmt("SELECT * FROM foo-1 AS t");
+ bigquery().verified_stmt("SELECT * FROM foo-1 JOIN bar-2 USING(id)");
+ bigquery().verified_stmt("SELECT * FROM foo-1, bar-2");
+ bigquery().verified_stmt("DELETE FROM foo-1 WHERE a = 1");
+ bigquery().verified_stmt("UPDATE foo-1 SET a = 1");
+ bigquery().verified_stmt("CREATE TABLE t-1 (a INT64)");
+ bigquery().verified_stmt("CREATE TABLE ship_mo-29 (a INT64)");
+
+ let err = bigquery()
+ .parse_sql_statements("SELECT * FROM foo-123a")
+ .unwrap_err();
+ assert_eq!(
+ ParserError::ParserError(
+ "Expected: whitespace following hyphenated identifier, found: a".to_string(),
+ ),
+ err
+ );
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org
(datafusion-sqlparser-rs) 02/02: Cover BigQuery hyphenated table boundaries
Posted by lu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
LucaCappelletti94 pushed a commit to branch bigquery-hyphen-numeric-boundary
in repository https://gitbox.apache.org/repos/asf/datafusion-sqlparser-rs.git
commit b9a5c362c58f4dd7fbb3633c54ec3fdbcadc0e39
Author: LucaCappelletti94 <ca...@gmail.com>
AuthorDate: Tue Oct 20 17:56:32 2026 +0200
Cover BigQuery hyphenated table boundaries
---
fuzz/fuzz_seeds/bigquery_2620_hyphen_numeric_boundary.sql | 5 +++++
tests/sqlparser_bigquery.rs | 13 +++++++++++++
2 files changed, 18 insertions(+)
diff --git a/fuzz/fuzz_seeds/bigquery_2620_hyphen_numeric_boundary.sql b/fuzz/fuzz_seeds/bigquery_2620_hyphen_numeric_boundary.sql
new file mode 100644
index 000000000..568b8e18b
--- /dev/null
+++ b/fuzz/fuzz_seeds/bigquery_2620_hyphen_numeric_boundary.sql
@@ -0,0 +1,5 @@
+SELECT * FROM project-1.dataset-2.table-3 WHERE x = 1;
+SELECT * FROM foo-1;
+SELECT * FROM (SELECT 1 FROM foo-1);
+SELECT * FROM foo-1, bar-2;
+CREATE TABLE t-1 (a INT64)
\ No newline at end of file
diff --git a/tests/sqlparser_bigquery.rs b/tests/sqlparser_bigquery.rs
index d847fe0f9..9492339ab 100644
--- a/tests/sqlparser_bigquery.rs
+++ b/tests/sqlparser_bigquery.rs
@@ -3012,6 +3012,9 @@ fn parse_hyphenated_identifier_after_numeric_segment() {
bigquery().verified_stmt("UPDATE foo-1 SET a = 1");
bigquery().verified_stmt("CREATE TABLE t-1 (a INT64)");
bigquery().verified_stmt("CREATE TABLE ship_mo-29 (a INT64)");
+ 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)");
let err = bigquery()
.parse_sql_statements("SELECT * FROM foo-123a")
@@ -3022,4 +3025,14 @@ fn parse_hyphenated_identifier_after_numeric_segment() {
),
err
);
+
+ 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
+ );
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org