apache / apache/datafusion-sqlparser-rs

Make `CreateTable.location` / `AlterTable.location` make more sense

Offen
#1,518 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Rust
Sterne
3.5k
Forks
772
Ø Merge
4 T. 9 Std.
Gemergte PRs (30 T.)
17

Beschreibung

`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?

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Beginne mit den Definitionen in docs.rs für CreateTable.location, CreateTable.hive_formats.location und AlterTable.location und verfolge anschließend das Parser-Verhalten für die in diesem Issue aufgeführten Formen CREATE EXTERNAL TABLE, CREATE TABLE und ALTER TABLE LOCATION. Als erledigt gilt die Aufgabe, wenn die Semantik von location konsistent umgesetzt oder eindeutig dokumentiert ist und für diese Fälle eine Regressionstestabdeckung vorhanden ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
rust, sql
Bereich
compilers, databases
Issue-Typ
Refactoring
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
30/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.