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 摘要。