apache/iceberg · error · UnsupportedOperationException
readFields is not supported.
Error message
readFields is not supported.
What it means
Container.readFields(DataInput) is intentionally unsupported: containers are populated directly by the Iceberg record reader rather than by Writable deserialization, so calling readFields always throws UnsupportedOperationException.
Solutions
- Do not use Container as the value class for shuffle/intermediate output; use a serializable Writable type instead.
- Read Iceberg data through the provided input format which populates Containers itself, and copy values out for downstream stages.
- Switch to the mapreduce IcebergInputFormat if you need framework-managed serialization.
Example fix
// before Container<Record> value = new Container<>(); value.readFields(in); // throws // after MyWritable value = new MyWritable(); value.readFields(in);
Defensive patterns
Strategy: type-guard
Validate before calling
if (Container.class.equals(job.getOutputValueClass())) {
throw new IllegalArgumentException("Container cannot be a reducer input value");
} Type guard
boolean supportsReadFields(Class<?> c) {
return Writable.class.isAssignableFrom(c)
&& !org.apache.iceberg.mr.mapred.Container.class.isAssignableFrom(c);
} Try / catch
try { value.readFields(in); }
catch (UnsupportedOperationException e) { throw new IOException("Container is read-only; use a writable value type", e); } Prevention
- Use dedicated Writable classes for intermediate MR data
- Let the Iceberg input format populate Containers instead of deserializing them
- Review job value classes when migrating between mapred and mapreduce APIs
When it happens
Trigger: A MapReduce framework path that attempts to deserialize values of type Container from DataInput (e.g. using Container as reducer input value class or in a sequence file read).
Common situations: Pipelined MR jobs using Iceberg's Container as intermediate value type; frameworks that call readFields reflectively on Writable value classes.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- write is not supported.
- Cannot modify a static table
- Cannot set fields in a TypeProjection
- Cannot update InternalRecordWrapper
- Could not set a field in the RowDataWrapper because rowData…
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/88cc5cd58523f986.
Report an issue: GitHub.
Appendix: source
Thrown at mr/src/main/java/org/apache/iceberg/mr/mapred/Container.java:49
private T value;
public T get() {
return value;
}
public void set(T newValue) {
this.value = newValue;
}
@Override
public void write(DataOutput dataOutput) {
throw new UnsupportedOperationException("write is not supported.");
}
@Override
public void readFields(DataInput dataInput) {
throw new UnsupportedOperationException("readFields is not supported.");
}
}
View on GitHub (pinned to 86d9c8fc54)