apache / apache/datafusion-sqlparser-rs

ClickHouse table function is recognized as TableFactor::Table

未关闭
#2,027 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Rust
星标
3.5k
派生
772
平均合并
4 天 9 小时
30 天内合并 PR
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()`).

贡献指南

这个仓库没有索引到贡献指南

调研方向

从 src/parser/mod.rs 中 issue 所链接的 Function 和 TableFunction 处理开始,然后比较 SELECT * FROM test 和 SELECT * FROM test() 的解析。通过 parser 输出确认已完成的行为,该输出应适当地将 ClickHouse 的 ident() 形式与普通表引用区分开来。

由索引模型根据 Issue 内容生成。

评估

技术栈
rust, sql
领域
compilers, databases
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
55/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。