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