apache / apache/datafusion-sqlparser-rs
Make `CreateTable.location` / `AlterTable.location` make more sense
- Dominant language
- Rust
- Stars
- 3.5k
- Forks
- 772
- Avg merge
- 4d 9h
- Merged PRs (30d)
- 17
Description
`CreateTable.location` has no documentation and is a tricky edge case, not always set even when SQL statement did set location.
https://docs.rs/sqlparser/latest/sqlparser/ast/struct.CreateTable.html#structfield.location
Since this took some time to figure out, here's what I've found for others also pondering its role:
- `CREATE EXTERNAL TABLE .. LOCATION 'foo'` sets `CreateTable.location`
- `CREATE TABLE .. LOCATION 'foo'` sets `CreateTable.hive_formats.location`
- `ALTER TABLE .. LOCATION` sets `AlterTable.location`
- `AlterTable.location` types are about Hive, and is thus a bit confusing for external tables: https://docs.rs/sqlparser/latest/sqlparser/ast/enum.Statement.html#variant.AlterTable.field.location
- alter vs create behaviors thus do not match
Maybe make Hive syntax use the top-level `location` field?
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the docs.rs definitions for CreateTable.location, CreateTable.hive_formats.location, and AlterTable.location, then trace the parser behavior for the CREATE EXTERNAL TABLE, CREATE TABLE, and ALTER TABLE LOCATION forms listed in the issue. Done means the location semantics are made consistent or clearly documented, with regression coverage for those cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, sql
- Domain
- compilers, databases
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100