apache / apache/datafusion-sqlparser-rs

Parser fails when using alias named "TOP" in SELECT statement

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

描述

Reproducer: Using datafusion-cli https://github.com/apache/datafusion/tree/main/datafusion-cli compiled from hash 5bbdb7eb1

```
> WITH t AS (SELECT 1 AS val) SELECT tt.val FROM t AS tt;
+-----+
| val |
+-----+
| 1 |
+-----+
1 row(s) fetched.
Elapsed 0.050 seconds.

> WITH t AS (SELECT 1 AS val) SELECT top.val FROM t AS top; 🤔 Invalid statement: SQL error: ParserError("Expected: literal int, found: . at Line: 1, Column: 39")
```

Found by SQLStorm https://github.com/apache/datafusion/issues/17698

贡献指南

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

调研方向

使用从 hash 5bbdb7eb1 构建的 datafusion-cli 重现该故障,并比较正常工作的别名 tt 与失败的别名 top。跟踪 SQL 解析器对 SELECT 别名中 TOP 的处理,并验证使用 top.val 的查询能够完成解析并返回预期的行。

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

评估

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

把新 issue 发到你的邮箱

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