apache / apache/datafusion-sqlparser-rs
Misleading error message for typo in IF NOT EXISTS
- 主要语言
- Rust
- 星标
- 3.5k
- 派生
- 772
- 平均合并
- 4 天 9 小时
- 30 天内合并 PR
- 17
描述
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`.
贡献指南
这个仓库没有索引到贡献指南
调研方向
从提供的 Rust 示例开始,使用 GenericDialect 和 Parser::parse_sql 解析 CREATE TABLE IF NOT EXIST 语句,然后跟踪 CREATE TABLE 和 IF NOT EXISTS 的 parser 路径。完成的标准是,该拼写错误会产生适当的 parser 错误,而不是误导性的语句结束消息。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- rust, sql
- 领域
- compilers, databases
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100