{"record":{"id":"88cc5cd58523f986","repo":"apache/iceberg","slug":"readfields-is-not-supported","errorCode":null,"errorMessage":"readFields is not supported.","messagePattern":"readFields is not supported\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"mr/src/main/java/org/apache/iceberg/mr/mapred/Container.java","lineNumber":49,"sourceCode":"\n  private T value;\n\n  public T get() {\n    return value;\n  }\n\n  public void set(T newValue) {\n    this.value = newValue;\n  }\n\n  @Override\n  public void write(DataOutput dataOutput) {\n    throw new UnsupportedOperationException(\"write is not supported.\");\n  }\n\n  @Override\n  public void readFields(DataInput dataInput) {\n    throw new UnsupportedOperationException(\"readFields is not supported.\");\n  }\n}\n","sourceCodeStart":31,"sourceCodeEnd":52,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/mr/src/main/java/org/apache/iceberg/mr/mapred/Container.java#L31-L52","documentation":"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.","triggerScenarios":"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).","commonSituations":"Pipelined MR jobs using Iceberg's Container as intermediate value type; frameworks that call readFields reflectively on Writable value classes.","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."],"exampleFix":"// before\nContainer<Record> value = new Container<>();\nvalue.readFields(in); // throws\n// after\nMyWritable value = new MyWritable();\nvalue.readFields(in);","handlingStrategy":"type-guard","validationCode":"if (Container.class.equals(job.getOutputValueClass())) {\n  throw new IllegalArgumentException(\"Container cannot be a reducer input value\");\n}","typeGuard":"boolean supportsReadFields(Class<?> c) {\n  return Writable.class.isAssignableFrom(c)\n      && !org.apache.iceberg.mr.mapred.Container.class.isAssignableFrom(c);\n}","tryCatchPattern":"try { value.readFields(in); }\ncatch (UnsupportedOperationException e) { throw new IOException(\"Container is read-only; use a writable value type\", e); }","preventionTips":["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"],"tags":["mapreduce","writable","read-only"],"backgroundTag":"unsupported-operation","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}