apache / apache/datafusion-sqlparser-rs

Parse errors should show location of error in input sql string

Offen
#301 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

When rust compiler finds a problem, it shows me exactly where to look:
```
error[E0308]: mismatched types
--> src/main.rs:73:12
|
72 | fn foo() -> String {
| ------ expected `std::string::String` because of return type
73 | return 42;
| ^^
| |
| expected struct `std::string::String`, found integer
| help: try using a conversion method: `42.to_string()`
```

When `Parser::parse_sql(...)` fails, it does not tell the user what part of the input caused the error:
```
sql parser error: Expected end of statement, found: ENGINE
```

The error should provide a position in the input sql string. Bonus points if it has nice presentation like the rust compiler error messages.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Beginne am Einstiegspunkt Parser::parse_sql(...) und verfolge, wie Parse-Fehler erstellt werden, indem du das gemeldete ENGINE-Beispiel verwendest, um die Eingabeposition zu ermitteln, die offengelegt werden sollte. Als erledigt gilt, wenn Parse-Fehler die fehlerhafte Position im SQL-String angeben; eine Darstellung im Rust-Stil ist eine optionale Erweiterung.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
rust, sql
Bereich
compilers
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

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