apache / apache/datafusion-sqlparser-rs
Regression: Decreased tolerance to column names matching SQL keywords
- 主要语言
- Rust
- 星标
- 3.5k
- 派生
- 772
- 平均合并
- 4 天 9 小时
- 30 天内合并 PR
- 17
描述
Related to: https://github.com/apache/datafusion/issues/17802
Between versions `0.57.0` and `0.58.0` there appears to be a regression that decreased parser tolerance to column names that collide with SQL keywords.
Example:
```rust
use sqlparser::dialect::GenericDialect;
use sqlparser::parser::Parser;
fn main() {
let dialect = GenericDialect {}; // or AnsiDialect
let sql = r#"
SELECT
'a' as a,
offset
FROM my_table
"#;
let ast = Parser::parse_sql(&dialect, sql).unwrap();
println!("AST: {:#?}", ast);
}
```
This works on version `0.57.0`, but fails on `0.58.0` with error:
```
ParserError("Expected: end of statement, found: my_table at Line: 5, Column: 14")
```
These queries work fine, which adds some confusing inconsistency into the mix:
```sql
SELECT
offset
FROM my_table
```
```sql
SELECT
offset,
'a' as a
FROM my_table
```
贡献指南
这个仓库没有索引到贡献指南
调研方向
首先,在 0.57.0 和 0.58.0 版本中分别使用 GenericDialect 和 AnsiDialect 重现报告的查询,然后比较 offset 列和 FROM 子句附近的 parser 行为。跟踪此示例所到达的 parser 入口点,并添加覆盖失败查询的回归测试;完成的标准是查询能够一致地完成解析,同时不破坏正常工作的变体。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- rust, sql
- 领域
- compilers
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 52/100