apache / apache/datafusion-sqlparser-rs

Nested type modifiers/complex type

未關閉
#1,932 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Rust
星號
3.5k
分支
774
平均合併
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 摘要。