apache / apache/iceberg-python

Enable stats collection for nested fields and use write.metadata.metrics.max-inferred-column-defaults to control stats growth

オープン
#2,699 コメント 4 件 リアクション 5 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
1.1k
フォーク
581
平均マージ
1日 17時間
マージ済み PR(30日)
78

説明

### Feature Request / Improvement

I recently discovered that full stats collection (i.e. `lower_bounds`/`upper_bounds`) is explicitly [disabled](https://github.com/apache/iceberg-python/blob/7acdb12f5239594e593f2822de75c7a4c669f52f/pyiceberg/io/pyarrow.py#L2220-L2223) in PyIceberg for nested (i.e. struct child) fields.

This change was made in [this PR](https://github.com/apache/iceberg/pull/7831) and specifically [this commit](https://github.com/apache/iceberg/pull/7831/commits/6f7bd987e50d4978aeae333d759e34422f7cfb78).

It seems that this change may have been made to limit the number of fields whose stats are collected when default-full stats collection is enabled. However, after discussion it seems that simply adding support for the `write.metadata.metrics.max-inferred-column-defaults` table [property](https://iceberg.apache.org/docs/nightly/configuration/#write-properties) would be the preferred way to control stats growth. If this is implemented, re-enabling stats collection for nested fields should be a non-issue.

Stats collection for nested struct fields is important for schemas like [GeoParquet](https://geoparquet.org/releases/v1.1.0/) which store important primitive fields (in this case, bounding box xmin, ymin, xmax, ymax) using structs.

See also [this slack thread](https://apache-iceberg.slack.com/archives/C029EE6HQ5D/p1762221916113919) for discussion.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

pyiceberg/io/pyarrow.py の、ネストされたフィールドの統計情報を無効にしているリンク先の行の周辺から始め、次に write.metadata.metrics.max-inferred-column-defaults がどのように処理されているかをたどってください。ネストされた struct フィールドで下限と上限を収集でき、テーブルプロパティによって推論された列の統計情報の増加が制御されるようになれば完了です。近くに見つかる場合は、既存の統計情報関連のテストを使って両方の動作を検証してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
data-engineering
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
66/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。