IN/NOT IN filters on identity-partitioned timestamp_ns columns fail or return wrong results

Abierto
#18,479 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@jiwen624 ya está trabajando en esto.

Desde el 24/10/2026.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
java
Área
databases

Línea de trabajo

The bug sits in how IN and NOT IN predicates on identity-partitioned timestamp_ns columns are evaluated during scan planning, so start from the partition projection and predicate evaluation code in the Iceberg core scan path. Reproduce with the three cases in the issue (file2026 IN overflow, file1970 IN returning 0 files, notIn deleteFromRowFilter dropping file1970). Done means all three cases behave as the 'after' results and a regression test covers nanosecond values near 1970 and 2026.

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

Other

Please describe the bug 🐞

On a v3 table with a timestamp_ns column ts partitioned by identity(ts), an IN or NOT IN filter with two or more values fails during scan planning:

table.newScan()
    .filter(Expressions.in("ts", "2026-01-01T00:00:00.000000001", "2025-01-01T00:00:00.000000001"))
    .planFiles();
// java.lang.ArithmeticException: long overflow

For timestamps near 1970-01-01 there is no error, but the results are wrong:

  • IN skips files that contain matching rows.
  • newDelete().deleteFromRowFilter(notIn(...)) deletes files whose rows all match an excluded value.
Schema schema = new Schema(optional(1, "ts", Types.TimestampNanoType.withoutZone()));
PartitionSpec spec = PartitionSpec.builderFor(schema).identity("ts").build();
// format v3 table; each case appends one DataFile whose partition is set with
// PartitionData.set(0, DateTimeUtil.isoTimestampToNanos(<its ts>))

// file2026 partitioned at ts = 2026-01-01T00:00:00.000000001
table.newScan().filter(Expressions.in("ts",
    "2026-01-01T00:00:00.000000001", "2025-01-01T00:00:00.000000001")).planFiles();
// before: ArithmeticException: long overflow    after: 1 file

// file1970 partitioned at ts = 1970-01-01T00:00:00.000001
table.newScan().filter(Expressions.in("ts",
    "1970-01-01T00:00:00.000001", "1970-01-01T00:00:00.000002")).planFiles();
// before: 0 files    after: 1 file

table.newDelete().deleteFromRowFilter(Expressions.notIn("ts",
    "1970-01-01T00:00:00.000001", "1970-01-01T00:00:00.000002")).commit();
// before: file1970 is deleted (scan returns 0 files)    after: file1970 is kept (1 file)
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.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.