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

Aperta
#18,479 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@jiwen624 ci sta già lavorando.

Dal 24/10/2026.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
java
Ambito
databases

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
Java
Stelle
9.4k
Fork
3.7k
Merge medio
2g 15h
PR unite (30g)
169

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/iceberg

Tutte le issue di apache/iceberg

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.