apache / apache/datafusion-sqlparser-rs

Nested type modifiers/complex type

オープン
#1,932 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Rust
スター
3.5k
フォーク
772
平均マージ
4日 9時間
マージ済み PR(30日)
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 を短くまとめたダイジェスト。