Spark: equality delete on a nested struct field deletes every row

Abierto
#18,620 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
58/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
java, spark
Área
backend

Línea de trabajo

Start at DeleteFilter.applyEqDeletes and trace how StructProjection reads the nested equality key from an InternalRowWrapper-wrapped Spark row; compare that path with GenericDeleteFilter, which the report says works. Reproduce with the nested-field equality delete and the Spark reader, then check that only rows with st.k equal to 5 or 10 are removed and 5760 remain. The issue does not name a test file.

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

Descripción

Apache Iceberg version

1.12.0 (iceberg-spark-runtime-4.1_2.13, Spark 4.1.3)

Query engine

Spark

Please describe the bug

An equality delete keyed on a field nested inside a struct removes every row when read through Iceberg's Spark reader, while Iceberg core's generic reader applies it correctly.

Repro

  1. CREATE TABLE t (id int, st struct<k int, s string>, payload bigint) USING iceberg TBLPROPERTIES ('format-version'='2', 'write.delete.mode'='merge-on-read')
  2. Insert 6000 rows with st = named_struct('k', id % 50, 's', concat('s', id % 7)); every struct and key is non-null.
  3. With the Java API write one Parquet equality delete file: delete schema table.schema().select("st.k"), equalityFieldIds = [field id of st.k], two records (built with GenericRecord.create(deleteSchema) and a populated child st) whose st.k is 5 and 10; commit with newRowDelta().addDeletes(...).
  4. Expected: 5760 rows remain (the rows with st.k not in {5, 10}).
    • IcebergGenerics.read(table).build() returns 5760 rows -- correct.
    • spark.table("t") / SELECT id FROM t returns 0 rows -- wrong.

The delete file is well formed: equality ids [4] match the data's st.k field id 4, the delete schema is {2: st: optional struct<4: k: optional int>}, record count 2, and the generic reader agrees with the independently computed expected set.

Where to look

The Spark reader's delete-apply path (DeleteFilter.applyEqDeletes with StructProjection over an InternalRowWrapper-wrapped Spark row) for an equality key that is a field inside a struct: the projected nested key apparently compares equal for every row, so every row matches the delete predicate. Core's GenericDeleteFilter path is not affected.

Found while building a native Iceberg scan for Spark that applies the same delete correctly (5760 rows) by reading the nested key through its ancestor struct.

Willingness to contribute
  • I can contribute a fix for this bug independently
Lenguaje dominante
Java
Estrellas
9.4k
Forks
3.7k
Merge medio
2 d 15 h
PR fusionados (30 d)
169

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de apache/iceberg

Todos los issues de apache/iceberg

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.