apache / apache/datafusion-sqlparser-rs

Missing Redshift constructs

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

描述

`RedshiftSqlDialect` on version 0.62.0 fails to parse a few core Redshift statements that the real engine accepts (tested on Redshift 1.0.347559):

```sql
-- 1. APPROXIMATE COUNT(DISTINCT)
SELECT APPROXIMATE COUNT(DISTINCT id) FROM t;
-- Expected: end of statement, found: (

-- 2. Column-level ENCODE in CREATE TABLE
CREATE TABLE t (id INT ENCODE az64, name VARCHAR(20) ENCODE lzo);
-- Expected: ',' or ')' after column definition, found: ENCODE

-- 3. CREATE EXTERNAL SCHEMA (Spectrum)
CREATE EXTERNAL SCHEMA s FROM DATA CATALOG DATABASE 'db' IAM_ROLE 'arn:...';
-- Expected: TABLE, found: SCHEMA
```

Each is documented, common Redshift syntax:
- `APPROXIMATE COUNT(DISTINCT ...)`: HyperLogLog cardinality [(docs)](https://docs.aws.amazon.com/redshift/latest/dg/r_COUNT.html)
- column-level compression `ENCODE ` in `CREATE TABLE` [(docs)](https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_TABLE_NEW.html)
- `CREATE EXTERNAL SCHEMA ... FROM DATA CATALOG`: Redshift Spectrum [(docs)](https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_EXTERNAL_SCHEMA.html)

贡献指南

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

调研方向

从 RedshiftSqlDialect 开始,跟踪三个 SQL 示例的 parser 路径;如果存在,检查附近的 dialect 测试。完成的标准是三个语句都能成功解析:APPROXIMATE COUNT(DISTINCT)、列级 ENCODE 和 CREATE EXTERNAL SCHEMA。

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

评估

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

把新 issue 发到你的邮箱

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