moshap-firebolt commented on PR #2437:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/2437#issuecomment-5332642596

   Thanks @LucaCappelletti94 — you're right that this isn't BigQuery-specific. 
I researched the other systems and reworked the PR to be dialect-generic:
   
   - **Moved the test to `tests/sqlparser_common.rs`** 
(`parse_create_vector_index`), so it round-trips across *all* dialects via 
`verified_stmt`, and dropped the BigQuery-only test. Doc comments no longer 
call it BigQuery-specific.
   - **Routed `CREATE VECTOR INDEX` through `parse_create_index`** instead of a 
separate BigQuery helper, so it inherits the existing index trailers. That 
means the cross-dialect variants parse for free:
     - **BigQuery** — `OPTIONS(...)` (reuses `parse_options`/`SqlOption`).
     - **Oracle / SQL Server** — `INCLUDE (...)` covering columns.
     - **Oracle / TiDB** — expression targets, e.g. `ON 
t(VEC_COSINE_DISTANCE(embedding))`.
     - **SQL Server** — `WITH (...)` (on dialects that enable 
`supports_create_index_with_clause`, incl. Generic).
     - **TiDB** — trailing `USING <method>` (via the existing index-options 
path).
   - `Display` order was aligned with parse order so `INCLUDE` + `OPTIONS` 
combinations round-trip.
   
   I deliberately left a few dialect-specific *option* grammars as follow-ups, 
since they need dedicated parsing with real keyword-collision hazards and don't 
fit the permissive shared path cleanly:
   - **Oracle** bare clauses — `ORGANIZATION`, `DISTANCE`, `WITH TARGET 
ACCURACY <n>`, `PARAMETERS(...)`. (`WITH TARGET ...` vs SQL Server's 
parenthesized `WITH (...)` vs the CTE `WITH` all overload the same keyword.)
   - **MariaDB** bare `DISTANCE=... M=...` options (bare single-letter `M` 
collides with identifiers).
   
   Happy to fold any of those in here if you'd prefer them in-scope rather than 
a follow-up. Sources: 
[BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_vector_index_statement),
 
[Oracle](https://docs.oracle.com/en/database/oracle/oracle-database/26/sqlrf/create-vector-index.html),
 [SQL 
Server](https://learn.microsoft.com/en-us/sql/t-sql/statements/create-vector-index-transact-sql),
 
[MariaDB](https://mariadb.com/docs/server/reference/sql-statements/data-definition/create/create-index),
 [TiDB](https://docs.pingcap.com/ai/vector-search-index/).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to