apache / apache/datafusion-sqlparser-rs

Add support for LIMIT prepared query

未关闭
#133 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Rust
星标
3.5k
派生
772
平均合并
4 天 9 小时
30 天内合并 PR
17

描述

Hi, I am using sqlparser 0.4.0 and rust version 1.36.0

Sql Query
`
SELECT "emp"."id" FROM "emp" WHERE "emp"."id" = $1 LIMIT $2 -- binds: [123, 5]
`

Parse error
`
ParserError("Expected literal int, found: $2")
`

Used Dialect:
```rust
impl Dialect for AckoPostgresSqlDialect {
fn is_identifier_start(&self, ch: char) -> bool {
(ch >= 'a' && ch <= 'z')
|| (ch >= 'A' && ch <= 'Z')
|| (ch == '@')
|| ch == '$'
|| ch == '_'
}

fn is_identifier_part(&self, ch: char) -> bool {
(ch >= 'a' && ch <= 'z')
|| (ch >= 'A' && ch <= 'Z')
|| (ch >= '0' && ch <= '9')
|| (ch == '@')
|| ch == '$'
|| ch == '_'
}
}
```

贡献指南

这个仓库没有索引到贡献指南

调研方向

从所示查询的 LIMIT 解析路径入手,检查 $2 在提供的 AckoPostgresSqlDialect 下是如何分类的。为 LIMIT 中的预处理参数添加支持,然后验证示例查询是否能使用 binds [123, 5] 成功解析。

由索引模型根据 Issue 内容生成。

评估

技术栈
rust, sql
领域
compilers
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
38/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。