apache / apache/datafusion-sqlparser-rs

Can't parse valid Snowflake compound expression

未关闭
#1,833 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Rust
星标
3.5k
派生
772
平均合并
4 天 9 小时
30 天内合并 PR
17

描述

Hey there, thanks for the great project!

I'm encountering an issue with the following query, which is valid in Snowflake:

```sql
SELECT v.$2 FROM (VALUES (1, 'value1'), (2, 'value2')) AS v
```

It can't get parsed with sqlparser-rs:

```
Expected: an identifier or a '*' after '.', found: $2 at Line: 1, Column: 10
```

While this syntax isn't valid in PostgreSQL, it is accepted by Snowflake. `SELECT $2 FROM ...` (without the alias) parses correctly, so it seems the parser has trouble with positional parameters when they're part of compound expressions.

Is this a gap in the Snowflake dialect implementation?

贡献指南

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

调研方向

首先,在 parser 的 Snowflake 方言处理中重现 Snowflake 查询 `SELECT v.$2 FROM (VALUES (1, 'value1'), (2, 'value2')) AS v`。跟踪复合表达式如何处理 alias 后的 `$2` 位置参数。完成标准是:这个有效的 Snowflake 表达式能够成功解析,同时不会使现有的 `SELECT $2 FROM ...` 情况发生回归。

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

评估

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

把新 issue 发到你的邮箱

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