apache / apache/datafusion-sqlparser-rs
`SHOW` statements silently dropping quoted strings
- 主要言語
- Rust
- スター
- 3.5k
- フォーク
- 772
- 平均マージ
- 4日 9時間
- マージ済み PR(30日)
- 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 ステートメントパーサーを追跡します。引用符で囲まれたトークンの処理を、示されている AST と比較します。引用符で囲まれた値が保持されるか、パーサーがその値を黙って破棄せずにエラーを報告すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- rust, sql
- 領域
- compilers, databases
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100