ORC: read fails after dropping the only field of a struct column
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- java, spark
- Domain
- data-engineering
Research direction
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.
Written by the indexing model from the issue text.
Description
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
- Dominant language
- Java
- Stars
- 9.5k
- Forks
- 3.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 170
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/iceberg
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Spark: Test INSERT targets with computed IDENTIFIER expressionsPossibly taken @shivadarshan-devadiga claimed this 15 days ago. Openimprovement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
[Core] TestAvroPartitionStatsHandler fails on Windows due to unclosed partition statistics scanPossibly taken @Ankitkj1999 claimed this 17 days ago. Open
Difficulty 1/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Core: TableMetadata.Builder allows adding encryption keys to v1/v2 tablesPossibly taken @yusufyildiz34 claimed this 37 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
apache/iceberg#18632 · 1 comment ·
Maintainers usually reply within 1 day
-
Kafka: Filter empty strings and whitespace in IcebergSinkConfig stringToListPossibly taken @mohamed-elbrik claimed this 42 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 1/5 1-3 hours Newbie friendliness 92/100
HexaHexes/neoforge-mod-template#124 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
OpenLiberty/open-liberty#36410 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
erkamyaman/rust-anything#1153 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Card-Forge/forge#13173 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day