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