apache / apache/datafusion-sqlparser-rs

ClickHouse table function is recognized as TableFactor::Table

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

説明

See https://clickhouse.com/docs/sql-reference/table-functions.

For example:
```sql
SELECT * FROM test;
SELECT * FROM test();
```

They produce:

> pre_visit_table_factor: Table { name: ObjectName([Identifier(Ident { value: "test", quote_style: None, span: Span(Location(1,16)..Location(1,20)) })]), alias: None, args: None, with_hints: [], version: None, with_ordinality: false, partitions: [], json_path: None, sample: None, index_hints: [] }

and

> pre_visit_table_factor: Table { name: ObjectName([Identifier(Ident { value: "test", quote_style: None, span: Span(Location(1,16)..Location(1,20)) })]), alias: None, args: Some(TableFunctionArgs { args: [], settings: None }), with_hints: [], version: None, with_ordinality: false, partitions: [], json_path: None, sample: None, index_hints: [] }

The second version produces `args: Some(TableFunctionArgs { args: [], settings: None })`.

As I see it's because [`Function`](https://github.com/apache/datafusion-sqlparser-rs/blob/b8539a52af7419b86d9c2fc51ba247d022f7a6f8/src/parser/mod.rs#L13498) is only recognized after a `LATERAL` keyword, and [`TableFunction`](https://github.com/apache/datafusion-sqlparser-rs/blob/b8539a52af7419b86d9c2fc51ba247d022f7a6f8/src/parser/mod.rs#L13511) is only for the `TABLE()` syntax (but not for `ident()`).

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

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

調査の方向性

issue でリンクされている Function と TableFunction の処理について、src/parser/mod.rs から始め、その後 SELECT * FROM test と SELECT * FROM test() のパースを比較します。ClickHouse の ident() 形式が単純なテーブル参照と適切に区別されていることを示す parser の出力で、完了した動作を確認します。

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

評価

技術スタック
rust, sql
領域
compilers, databases
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
55/100

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

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