apache / apache/iceberg-python

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

Ouverte
#2,699 4 commentaires 5 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Python
Étoiles
1.1k
Forks
581
Merge moyen
1 j 17 h
PR mergées (30 j)
78

Description

### 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.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

Commencez dans pyiceberg/io/pyarrow.py, autour des lignes liées qui désactivent les statistiques pour les champs imbriqués, puis suivez la manière dont write.metadata.metrics.max-inferred-column-defaults est géré. Le travail est terminé lorsque les champs struct imbriqués peuvent collecter des bornes inférieures et supérieures, tandis que la propriété de la table contrôle la croissance des statistiques des colonnes inférées ; utilisez les tests existants liés aux statistiques, s'il y en a à proximité, pour vérifier les deux comportements.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
python
Domaine
data-engineering
Type d'issue
Fonctionnalité
Difficulté
4/5
Temps estimé
3-5 jours
Activité
Active
Clarté
Plutôt claire
Accessibilité débutants
66/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.