apache / apache/datafusion-sqlparser-rs

How to best add support for IDENTIFIER() clause

Đang mở
#1,412 3 bình luận 0 reaction 0 người được giao Xem trên GitHub
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ả

I am thinking about adding support for the IDENTIFIER() clause (available in Snowflake and Databricks, see docs below).

In OpenLineage, I was able to [partially support it](https://github.com/OpenLineage/OpenLineage/pull/2999) by implementing visitors, but that only worked for a couple of statement types (SELECT, MERGE, UPDATE, DELETE) - the ones where i was able to access a TableFactor and not only ObjectName.

I believe, that in order to be able to recognize every use case of IDENTIFIER clause in the visitors I'd have to modify all the statements to provide access to TableFactor or some similar struct. This specific clause if problematic as it can appear anywhere an object name is referenced, and i believe there is no single place in the parser where i could add support for such a syntax. For now I am only interested in recognizing this clause in table names, so that limits the scope a little bit.

Does anyone have some ideas on how to best approach this problem? I'd like to use the limited resources I have in the best possible way and I feel like I'm missing something obvious here.

@iffyio, maybe you have some time and idea for that? You helped me with my previous PR 😄

Docs:
[Snowflake](https://docs.snowflake.com/en/sql-reference/identifier-literal)
[Databricks](https://docs.databricks.com/en/sql/language-manual/sql-ref-names-identifier-clause.html)

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 bằng cách lần theo các visitor hiện có cho SELECT, MERGE, UPDATE và DELETE, so sánh những nơi chúng nhận một TableFactor thay vì chỉ một ObjectName. Xem xét các biểu diễn câu lệnh và các điểm vào của parser để xác định cách nhận diện nhất quán các cách sử dụng IDENTIFIER() cho tên bảng; được xem là hoàn tất khi đã thống nhất một cách tiếp cận và xác định phạm vi bao phủ cho các loại câu lệnh liên quan.

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, databases
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.