ORC: read fails after dropping the only field of a struct column

Aperta
#19,137 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@Mithilbatra ci sta già lavorando.

Dal 27/11/2026.

  • #19157 di @Mithilbatra — aperta

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, spark

Direzione di ricerca

The failure comes from the ORC read path: OrcValueReaders$StructReader in core/src/main/java/org/apache/iceberg/orc/OrcValueReaders.java throws 'Missing ORC reader for field s' when a struct has no remaining child readers. Compare with the Parquet path, which returns an empty struct, and start by reproducing with the Spark SQL steps in the issue. Done means the ORC read returns the row with an empty struct, with a regression test added to the ORC read tests.

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

Descrizione

bug
Apache Iceberg version

main (development)

Query engine

Spark

Please describe the bug 🐞

After DROP COLUMN s.a removes the only field of s STRUCT<a:INT>, every read of existing ORC files fails with Missing ORC reader for field s. The same steps on Parquet return the row with an empty struct. Reproduced on main (2e12b22, 2026-11-25) and 1.12.0, Spark 3.5.5.

Reproduction
-- control: Parquet
CREATE TABLE local.p (id INT, s STRUCT<a:INT>) USING iceberg;
INSERT INTO local.p VALUES (1, named_struct('a', 10));
ALTER TABLE local.p DROP COLUMN s.a;
SELECT 'parquet' AS marker, id, s FROM local.p;

-- ORC: fails
CREATE TABLE local.t (id INT, s STRUCT<a:INT>) USING iceberg TBLPROPERTIES ('write.format.default'='orc');
INSERT INTO local.t VALUES (1, named_struct('a', 10));
ALTER TABLE local.t DROP COLUMN s.a;
SELECT 'orc' AS marker, id, s FROM local.t;
Expected

Both tables return the row with an empty struct, as Parquet does:

parquet	1	{}
orc	1	{}
Actual

Parquet returns parquet 1 {}. The ORC SELECT fails:

java.lang.IllegalArgumentException: Missing ORC reader for field s (2)
	at org.apache.iceberg.orc.OrcValueReaders$StructReader.<init>(OrcValueReaders.java:224)
	at org.apache.iceberg.spark.data.SparkOrcValueReaders$StructReader.<init>(SparkOrcValueReaders.java:154)
	at org.apache.iceberg.spark.data.SparkOrcValueReaders.struct(SparkOrcValueReaders.java:78)
	at org.apache.iceberg.spark.data.SparkOrcReader$ReadBuilder.record(SparkOrcReader.java:80)
	at org.apache.iceberg.orc.OrcSchemaWithTypeVisitor.visitRecord(OrcSchemaWithTypeVisitor.java:80)
	at org.apache.iceberg.spark.data.SparkOrcReader.<init>(SparkOrcReader.java:53)
	at org.apache.iceberg.orc.OrcIterable.iterator(OrcIterable.java:118)
	at org.apache.iceberg.spark.source.RowDataReader.open(RowDataReader.java:108)
	at org.apache.iceberg.spark.source.BaseReader.next(BaseReader.java:145)
	...
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.5k
Fork
3.7k
Merge medio
2g 2h
PR unite (30g)
170

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.