apache / apache/datafusion-sqlparser-rs

Parse errors should show location of error in input sql string

Aperta
#301 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Rust
Stelle
3.5k
Fork
772
Merge medio
4g 9h
PR unite (30g)
17

Descrizione

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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Inizia dal punto di ingresso Parser::parse_sql(...) e traccia il modo in cui vengono costruiti gli errori di parsing, usando l’esempio ENGINE segnalato per identificare la posizione nell’input che dovrebbe essere esposta. Il lavoro è completato quando gli errori di parsing identificano la posizione problematica nella stringa SQL; una presentazione in stile Rust è un miglioramento facoltativo.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
rust, sql
Ambito
compilers
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.