apache/iceberg · error · IllegalArgumentException
Invalid iceberg type %s corresponding to ORC type %s
Error message
Invalid iceberg type %s corresponding to ORC type %s
What it means
GenericOrcWriter.primitive() throws IllegalArgumentException when an Iceberg primitive type has no corresponding ORC writer mapping in the current branch (expected e.g. BINARY->byteBuffers, DECIMAL->decimal; anything else is invalid for writing).
Source
Thrown at orc/src/main/java/org/apache/iceberg/data/orc/GenericOrcWriter.java:134
Types.TimestampNanoType timestampNanoType = (Types.TimestampNanoType) iPrimitive;
if (timestampNanoType.shouldAdjustToUTC()) {
return GenericOrcWriters.timestampTzNanos();
} else {
return GenericOrcWriters.timestampNanos();
}
case STRING:
return GenericOrcWriters.strings();
case UUID:
return GenericOrcWriters.uuids();
case FIXED:
return GenericOrcWriters.byteArrays();
case BINARY:
return GenericOrcWriters.byteBuffers();
case DECIMAL:
Types.DecimalType decimalType = (Types.DecimalType) iPrimitive;
return GenericOrcWriters.decimal(decimalType.precision(), decimalType.scale());
default:
throw new IllegalArgumentException(
String.format(
"Invalid iceberg type %s corresponding to ORC type %s", iPrimitive, primitive));
}
}
}
@Override
public void write(Record value, VectorizedRowBatch output) {
Preconditions.checkArgument(value != null, "value must not be null");
writer.writeRow(value, output);
}
@Override
public List<OrcValueWriter<?>> writers() {
return writer.writers();
}
@OverrideView on GitHub (pinned to 86d9c8fc54)
Solutions
- Upgrade Iceberg to a version whose GenericOrcWriter supports the type.
- Change the column type to one supported by the ORC writer (e.g., use binary or long).
- Write those columns as a supported type or store them serialized.
- Use a different file format (Parquet/Avro) that supports the type for this table.
Example fix
// before schema: uuid_col UUID -- GenericOrcWriter has no mapping -> IllegalArgumentException // after ALTER TABLE ... ALTER COLUMN uuid_col TYPE BINARY; // store as bytes
Defensive patterns
Strategy: validation
Validate before calling
// ensure the type is writable to ORC
if (!(iPrimitive instanceof Types.BinaryType || iPrimitive instanceof Types.DecimalType /* ...supported set */)) {
throw new IllegalArgumentException("not writable to ORC: " + iPrimitive);
} Type guard
boolean writableToOrc = SUPPORTED_PRIMITIVES.contains(iPrimitive.typeId());
Prevention
- Check supported ORC writer mappings before choosing column types
- Use Parquet/Avro for types ORC does not support
- Keep Iceberg versions current
- Test appends with the full schema before production
When it happens
Trigger: Writing data to ORC data files where a column's Iceberg primitive type is not supported by the writer mapping (e.g., writing a TIMESTAMP_NTZ or UUID variant not handled in that branch).
Common situations: Writing tables with newly introduced Iceberg types using an older Iceberg ORC writer; appends with schemas containing types ORC support doesn't cover in this code path.
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
- Encountered an unsupported ORC type during a write from Spar
- Unhandled type
- Unhandled type
- Unhandled type {primitive}
- Cannot read unsupported column types:
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/44bad8a803e39715.
Report an issue: GitHub.