apache / apache/datafusion-sqlparser-rs
Support `COLUMNS(* EXLCUDE(col1, col2))` syntax
- 主要語言
- Rust
- 星號
- 3.5k
- 分支
- 772
- 平均合併
- 4 天 9 小時
- 30 天內合併 PR
- 17
描述
DuckDB supports excluding columns via this syntax:
```
SELECT COLUMNS(* EXCLUDE(col1, col2)) FROM tbl
```
Currently this format gives a syntax error:
```
Parse error: sql parser error: Expected: ), found: EXCLUDE at Line: 1, Column: 18
```
More details at: https://duckdb.org/docs/stable/sql/expressions/star.html#columns-expression
Note that other modifiers beyond `EXCLUDE` are supported, such as `REPLACE`, `RENAME`, `LIKE` etc, see the syntax diagram at https://duckdb.org/docs/stable/sql/query_syntax/select.html#syntax (click `star-options` on the digram to expand).
This highly suggests that the general solution for this would be to add a new `Expr::Columns` expression enum with parsing logic somewhat similiar to `Expr::MatchAgainst`, and then add logic in `parse_select_item` to support returning a `SelectItem::UnnamedExpr(Expr::Columns)`.
貢獻指南
這個儲存庫沒有索引到貢獻指南
研究方向
從 parse_select_item 開始,比較 Expr::MatchAgainst 的解析路徑。新增對以 SelectItem::UnnamedExpr(Expr::Columns) 形式返回的 Expr::Columns 表達式的支援,然後驗證文件中所述的 COLUMNS(* EXCLUDE(...)) 形式,以及列出的 REPLACE、RENAME 和 LIKE 修飾詞都能成功解析。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- rust, sql
- 領域
- compilers
- Issue 類型
- 功能
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100