apache / apache/datafusion-sqlparser-rs
Misleading error message for typo in IF NOT EXISTS
- Lingua principale
- Rust
- Stelle
- 3.5k
- Fork
- 772
- Merge medio
- 4g 9h
- PR unite (30g)
- 17
Descrizione
See also https://github.com/GreptimeTeam/greptimedb/issues/3471.
For sqlparser-rs -
```rust
fn main() {
let sql = "CREATE TABLE IF NOT EXIST ();";
let dialect = GenericDialect {};
let ast = Parser::parse_sql(&dialect, sql).unwrap();
println!("AST: {ast:?}");
}
```
throws:
```
called `Result::unwrap()` on an `Err` value: ParserError("Expected end of statement, found: NOT at Line: 1, Column 17")
```
IIUC if we found `IF` already, the next keywords SHOULD BE `NOT EXIST` and thus the parsing logics should be `.expect_keywords`.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Direzione di ricerca
Inizia con l'esempio Rust fornito, usando GenericDialect e Parser::parse_sql sull'istruzione CREATE TABLE IF NOT EXIST; poi segui il percorso del parser per CREATE TABLE e IF NOT EXISTS. Il lavoro è completato quando il refuso produce un errore appropriato del parser invece del messaggio fuorviante di fine istruzione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- rust, sql
- Ambito
- compilers, databases
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100