apache / apache/datafusion-sqlparser-rs
Support `COLUMNS(* EXLCUDE(col1, col2))` syntax
- Ngôn ngữ chính
- Rust
- Star
- 3.5k
- Fork
- 772
- Merge trung bình
- 4 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 17
Mô tả
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)`.
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Bắt đầu tại parse_select_item và so sánh đường dẫn phân tích cú pháp của Expr::MatchAgainst. Thêm hỗ trợ cho một biểu thức Expr::Columns được trả về dưới dạng SelectItem::UnnamedExpr(Expr::Columns), sau đó xác minh rằng dạng COLUMNS(* EXCLUDE(...)) được ghi trong tài liệu cùng các modifier REPLACE, RENAME và LIKE được liệt kê đều được phân tích cú pháp thành công.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- rust, sql
- Lĩnh vực
- compilers
- Loại issue
- Tính năng
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100