apache / apache/datafusion-sqlparser-rs

How to best add support for IDENTIFIER() clause

Offen
#1,412 3 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Rust
Sterne
3.5k
Forks
772
Ø Merge
4 T. 9 Std.
Gemergte PRs (30 T.)
17

Beschreibung

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)

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Beginne damit, die bestehenden Besucher für SELECT, MERGE, UPDATE und DELETE nachzuverfolgen und zu vergleichen, wo sie einen TableFactor statt nur eines ObjectName erhalten. Prüfe die Anweisungsrepräsentationen und Parser-Einstiegspunkte, um zu bestimmen, wie Verwendungen von IDENTIFIER() für Tabellennamen konsistent erkannt werden können; als erledigt gilt dies, wenn ein Ansatz vereinbart und die Abdeckung für die relevanten Anweisungstypen definiert wurde.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
rust, sql
Bereich
compilers, databases
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.