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