apache / apache/datafusion-sqlparser-rs
`SHOW` statements silently dropping quoted strings
- Linguagem predominante
- Rust
- Estrelas
- 3.5k
- Forks
- 772
- Merge médio
- 4d 9h
- PRs com merge (30d)
- 17
Descrição
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
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Direção de pesquisa
Reproduza SHOW FUNCTIONS LIKE '%date%' e rastreie o parser genérico de instruções SHOW que constrói o AST ShowVariable. Compare o tratamento de tokens entre aspas com o AST mostrado; considera-se concluído quando o valor entre aspas é preservado ou o parser relata um erro em vez de descartá-lo silenciosamente.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- rust, sql
- Domínio
- compilers, databases
- Tipo de issue
- Bug
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 35/100