apache / apache/datafusion-sqlparser-rs

How to best add support for IDENTIFIER() clause

オープン
#1,412 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Rust
スター
3.5k
フォーク
772
平均マージ
4日 9時間
マージ済み PR(30日)
17

説明

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)

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

まず、SELECT、MERGE、UPDATE、DELETE 用の既存の visitor を追跡し、TableFactor を受け取る箇所と ObjectName のみを受け取る箇所を比較します。文の表現と parser のエントリーポイントを確認し、テーブル名に対する IDENTIFIER() の使用を一貫して認識する方法を決定します。アプローチについて合意し、関連する文の型に対するカバレッジを定義できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
rust, sql
領域
compilers, databases
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。