Spark: dynamic `INSERT OVERWRITE` duplicates data after a partition field is renamed

Abierto
#19,195 4 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@adiranjan25 ya está trabajando en esto.

Desde el 30/11/2026.

  • #19206 de @adiranjan25 — abierto

Evaluación

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

Línea de trabajo

Start by locating Spark's dynamic partition overwrite handling and the tests for INSERT OVERWRITE after partition evolution; the issue does not name specific files. Reproduce the supplied SQL on Spark 3.5.5 and compare the renamed-partition result with the control. Done means the renamed case returns [2,9] while the control remains [2,9].

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

Descripción

bug
Apache Iceberg version

1.12.0 (latest release)

Query engine

Spark

Please describe the bug 🐞

After a partition field is only renamed (REPLACE PARTITION FIELD p WITH p AS p_renamed), a dynamic INSERT OVERWRITE keeps the old rows of the overwritten partition and adds the new rows next to them. Reproduced on main (9d4f6c7, 2026-11-28) and 1.12.0, Spark 3.5.5.

Reproduction
SET spark.sql.sources.partitionOverwriteMode=dynamic;

CREATE TABLE local.db.t (id INT, p STRING) USING iceberg PARTITIONED BY (p);
INSERT INTO local.db.t VALUES (1, 'a'), (2, 'b');
ALTER TABLE local.db.t REPLACE PARTITION FIELD p WITH p AS p_renamed;
INSERT OVERWRITE local.db.t SELECT 9, 'a';
SELECT 'renamed', collect_list(id) FROM (SELECT id FROM local.db.t ORDER BY id);

-- control: no rename
CREATE TABLE local.db.c (id INT, p STRING) USING iceberg PARTITIONED BY (p);
INSERT INTO local.db.c VALUES (1, 'a'), (2, 'b');
INSERT OVERWRITE local.db.c SELECT 9, 'a';
SELECT 'control', collect_list(id) FROM (SELECT id FROM local.db.c ORDER BY id);
Expected
Query Result
renamed [2,9]
control [2,9]
Actual
Query Result
renamed [1,2,9]
control [2,9]
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
Java
Estrellas
9.5k
Forks
3.7k
Merge medio
2 d 2 h
PR fusionados (30 d)
170

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.