apache / apache/datafusion-sqlparser-rs

Support for spark `USING` and `OPTIONS` keyword

Open
#1,505 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
3.5k
Forks
772
Avg merge
4d 9h
Merged PRs (30d)
17

Description

Hi,

I was trying to extract options from a create table query, but it seems like this syntax from spark is not supported:

```sql
CREATE TABLE chin_dbo_Track_LIMIT USING org.apache.spark.sql.jdbc OPTIONS (url "jdbc:sqlserver://localhost:1433;database=Chinook;user=sa;password=mypassword",dbtable "(SELECT TOP 100
[E12].[TrackId] [TrackId]
,[E12].[Name] [Name]
,[E12].[AlbumId] [AlbumId]
,[E12].[MediaTypeId] [MediaTypeId]
,[E12].[GenreId] [GenreId]
,[E12].[Composer] [Composer]
,[E12].[Milliseconds] [Milliseconds]
,[E12].[Bytes] [Bytes]
,[E12].[UnitPrice] [UnitPrice]
FROM
[Chinook].[dbo].[Track] [E12]) obj",driver "com.microsoft.sqlserver.jdbc.SQLServerDriver")
```

Parse error:

```
ParserError("Expected: end of statement, found: USING at Line: 2, Column: 43")
```

This also does not work if I remove the using JDBC part, then it does not expect `OPTIONS`

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the reported parser error with the supplied Spark CREATE TABLE statement, then trace the CREATE TABLE parsing entry point and existing tests for table options. The work is done when supported USING and OPTIONS syntax parses successfully and regression coverage verifies the example without breaking existing CREATE TABLE statements.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, sql
Domain
databases
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.