`add_column` changes the values of an existing column for files without field IDs
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 57/100
Línea de trabajo
Start with _remove_reassigned_names in pyiceberg/table/name_mapping.py and trace how schema updates change name mappings for files without field IDs. Reproduce the report using the supplied add_files, rename, and add_column sequence, then check both scan results and IsNull("b") filtering. Done means the existing column keeps its values and the filter returns the matching rows after adding the reused name.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Apache Iceberg version
0.12.0 (latest release); the same logic is on main
Please describe the bug 🐞
Adding a column changes what an existing column reads. Files added with add_files have no field IDs and are read through the name mapping. After a rename, the renamed column reads correctly. Adding a column that reuses the old name then moves that name to the new field in the mapping (_remove_reassigned_names in pyiceberg/table/name_mapping.py). From then on, the renamed column reads as null for those files, and the new column gets its values.
The manifest statistics of those files still describe the original field, so planning also prunes with statistics that no longer match what is read: below, IsNull("b") skips the file although both rows read b as null.
import tempfile
import pyarrow as pa
import pyarrow.parquet as pq
from pyiceberg.catalog.sql import SqlCatalog
from pyiceberg.expressions import IsNull
from pyiceberg.schema import Schema
from pyiceberg.types import LongType, NestedField
d = tempfile.mkdtemp()
catalog = SqlCatalog("c", uri=f"sqlite:///{d}/c.db", warehouse=f"file://{d}")
catalog.create_namespace("ns")
table = catalog.create_table("ns.t", Schema(NestedField(1, "a", LongType())))
# a Parquet file without field IDs, read through the name mapping
pq.write_table(pa.table({"a": [1, 3]}), f"{d}/imported.parquet")
table.add_files([f"file://{d}/imported.parquet"])
with table.update_schema() as update:
update.rename_column("a", "b")
print(table.scan().to_arrow().to_pydict())
# {'b': [1, 3]}
with table.update_schema() as update:
update.add_column("a", LongType())
print(table.scan().to_arrow().to_pydict())
# {'b': [None, None], 'a': [1, 3]}: expected {'b': [1, 3], 'a': [None, None]}
print(table.scan(row_filter=IsNull("b")).to_arrow().num_rows)
# 0: the file is pruned by the statistics of `b`, which hold its original values
Expected: adding a column leaves the values of existing columns unchanged, as it does for files with field IDs. The name was written for the original field in those files, so either the mapping keeps it there, or adding a column whose name files without field IDs still use is refused.
Willingness to contribute
- I can contribute a fix for this bug independently
- I would be willing to contribute a fix for this bug with guidance from the Iceberg community
- I cannot contribute a fix for this bug at this time
- Lenguaje dominante
- Python
- Estrellas
- 1.2k
- Forks
- 654
- Merge medio
- 2 d 11 h
- PR fusionados (30 d)
- 122
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de apache/iceberg-python
-
`inspect.files()` and the other file metadata tables raise `ArrowInvalid` when a snapshot has no manifestsPosiblemente ocupada @YuangGao la tomó hace 10 días. Abiertokind:bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
apache/iceberg-python#4269 ·
Los mantenedores suelen responder en 1 día
-
`inspect.entries()` raises TypeError when a data file has no column_sizesPosiblemente ocupada @Rahul-cs50 la tomó hace 14 días. Abiertokind:bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
apache/iceberg-python#4186 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
`older_than` reads a naive datetime as UTC and expires snapshots it should keepPosiblemente ocupada @Rahul-cs50 la tomó hace 13 días. Abiertokind:bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
apache/iceberg-python#4182 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
REST: Send empty first-page pageToken when rest-page-size is setPosiblemente ocupada @ehddnr301 la tomó hace 32 días. Abiertokind:bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
apache/iceberg-python#4096 ·
Los mantenedores suelen responder en 1 día
-
PyArrowFileIO: every small S3 write is a 3-request multipart upload; expose allow_delayed_openPosiblemente ocupada @David-Banquet la tomó hace 29 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
apache/iceberg-python#4093 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de apache/iceberg-python
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
glossyio/traffic-monitor#312 ·
Los mantenedores suelen responder en 1 día
-
local devenv exampleAbiertodocumentation enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
es-ude/elastic-ai.creator#1046 ·
Los mantenedores suelen responder en 3 días
-
ENH: permit cachetools >= 7Abiertofeature request
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
confident-ai/deepteam#306 ·
Los mantenedores suelen responder en 1 día
-
SslLibrary crashes with unhandled OSError: port/proto not found on non-standard SSL portsPosiblemente ocupada @himanchalkaushale la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
OWASP/Nettacker#1884 · 1 comentario ·
Los mantenedores suelen responder en 1 día