apache / apache/iceberg-python

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

Abierto
#2,699 4 comentarios 5 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Python
Estrellas
1.1k
Forks
581
Merge medio
1 d 17 h
PR fusionados (30 d)
78

Descripción

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

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Empieza en pyiceberg/io/pyarrow.py, alrededor de las líneas enlazadas que deshabilitan las estadísticas para campos anidados, y después sigue cómo se gestiona write.metadata.metrics.max-inferred-column-defaults. Se considera terminado cuando los campos struct anidados pueden recopilar límites inferiores y superiores, mientras la propiedad de la tabla controla el crecimiento de las estadísticas de columnas inferidas; usa las pruebas existentes relacionadas con las estadísticas, si encuentras alguna cerca, para verificar ambos comportamientos.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
data-engineering
Tipo de issue
Nueva funcionalidad
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Activo
Claridad
Bastante claro
Aptitud para principiantes
66/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.