apache / apache/datafusion-sqlparser-rs
`SHOW` statements silently dropping quoted strings
- 主要語言
- Rust
- 星號
- 3.5k
- 分支
- 772
- 平均合併
- 4 天 9 小時
- 30 天內合併 PR
- 17
描述
When parsing generic `SHOW` statements such as `SHOW FUNCTIONS` or `SHOW PARAMETERS`, the parser creates a `ShowVariable` AST with each of the tokens after `SHOW` added as a `variable` node. This should allow functionality like `SHOW FUNCTIONS LIKE '%date%'` to be written by processing the AST even if the lexer doesn't understand what the query means.
However, this query `SHOW FUNCTIONS LIKE '%date%'` is parser to:
~~~json
[
{
"ShowVariable": {
"variable": [
{
"value": "FUNCTIONS",
"quote_style": null
},
{
"value": "LIKE",
"quote_style": null
}
]
}
}
]
~~~
Where the value in quotes is removed.
I think this is probably because `SHOW` queries, not followed by a well-known token (e.g. `SHOW VARIABLES`, `SHOW COLUMNS`) defaults to a variation of `SHOW VARIABLE`, and the tokens afterwards are expected to be formatted like Identifiers, but a quoted string doesn't match this expectation. If that is the case, I expect an error to be raised rather than silently dropping part of the query.
Thanks
貢獻指南
這個儲存庫沒有索引到貢獻指南
研究方向
重現 SHOW FUNCTIONS LIKE '%date%',並追蹤建構 ShowVariable AST 的通用 SHOW 陳述式剖析器。將其對帶引號 token 的處理與所示 AST 進行比較;當帶引號的值被保留,或剖析器回報錯誤而不是靜默捨棄該值時,即視為完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- rust, sql
- 領域
- compilers, databases
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100