apache / apache/datafusion-sqlparser-rs

Nested type modifiers/complex type

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

描述

Example Trino SQL:
```sql
SELECT
row_id,
array_agg(
CAST(
ROW(
total_amount
)
AS
ROW(
total_amount Decimal(14,2)
)
)
ORDER BY payment_requested_date DESC
) AS payment_request_details
FROM
iceberg.my_table_name
GROUP BY 1
```

This throws an error when using `GenericDialect`, specifically when it tries to parse `Decimal(14,2)`: ```ParserError("Expected: type modifiers, found: ( at Line: 10, Column: 37")```

Stepping through the code it looks like this is because it does not support deeply nested definitions because `parse_optional_type_modifiers` does not allow `Token::LParen`.

This may be by design, but it may break parsing when you get to really complex queries (e.g. deeply nested rows).

贡献指南

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

调研方向

从 GenericDialect 对嵌套类型定义和 parse_optional_type_modifiers 的处理开始,然后重现提供的查询以确认 Decimal(14,2) 失败。跟踪嵌套 ROW 类型的解析方式,并添加回归覆盖,表明该查询可以使用其嵌套类型修饰符成功解析。

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

评估

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

把新 issue 发到你的邮箱

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