apache / apache/datafusion-sqlparser-rs
SQL is parsed incorrectly when `trailing_commas` is not set
- 主要语言
- Rust
- 星标
- 3.5k
- 派生
- 772
- 平均合并
- 4 天 9 小时
- 30 天内合并 PR
- 17
描述
When parser not set `trailing_commas=true` in `ParserOptions` or use `BigQueryDialect`, the following SQL will be wrongly parse instead of throw an error.
```sql
SELECT foo, bar, FROM baz
-- Will be wrongly parse instead of throw an error.
SELECT foo, bar, FROM AS baz
```
In theory it should throw a error
relevant code
```rust
#[test]
fn parse_range_select() {
let statements = Parser::parse_sql(&GenericDialect {}, "SELECT foo, bar, FROM baz").unwrap();
println!("{}", statements[0]);
}
```
贡献指南
这个仓库没有索引到贡献指南
调研方向
从 parse_range_select 示例中的 Parser::parse_sql 调用开始,检查 trailing_commas 未设置时 GenericDialect 如何处理 SELECT 列表。添加一个涵盖所示查询的回归测试:拒绝带有尾随逗号的格式错误语法,同时继续支持已配置的 trailing_commas 行为。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- rust
- 领域
- compilers
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100