apache/iceberg · error · IllegalArgumentException
Encountered an unsupported ORC type during a write from…
Error message
Encountered an unsupported ORC type during a write from Spark.
What it means
SparkOrcWriter.createFieldGetter maps Iceberg/Spark field types to ORC field getter functions. The default branch fires when the column's Iceberg TypeID is not one of the supported ORC-writable types (e.g. a nested or unrecognized type id reached the switch). This is a schema-support guard: the writer cannot produce an ORC encoding for that type.
Solutions
- Check the table schema for columns whose Iceberg type is unsupported by this Spark ORC writer version and drop/retype them.
- Upgrade the iceberg-spark module to a version matching your Spark release so all types in the schema are supported.
- Cast unsupported columns to a supported type (e.g. string/binary) before writing.
Example fix
// before
// writing table with an exotic nested type column
// after
// cast the column to a supported type before writing
df = df.withColumn("col", col("col").cast("string")); Defensive patterns
Strategy: validation
Validate before calling
// validate all column types are supported before writing
schema.columns().forEach(c -> Preconditions.checkArgument(
Set.of(BOOLEAN, INT, LONG, FLOAT, DOUBLE, DATE, TIMESTAMP, STRING, BINARY, DECIMAL, FIXED)
.contains(c.type().typeId()),
"Unsupported ORC write type: %s", c.type())); Prevention
- Keep iceberg-spark version aligned with your Spark version
- Review table schemas for exotic types before enabling ORC writes
- Test schema evolution changes in a staging table first
When it happens
Trigger: Writing a Spark DataFrame through Iceberg's ORC writer where a column's Iceberg type resolves to a TypeID not handled by createFieldGetter's switch (e.g. an unsupported nested type variant).
Common situations: Using newer or exotic Iceberg types (e.g. unknown/nested types, variant-like types) with an older Spark ORC writer module; schema drift after table evolution where the writer version predates the type.
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…
- Encountered an unsupported ORC type during a write from…
- Encountered an unsupported ORC type during a write from…
- Unhandled type
- Unhandled type
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/609a7ac7abbdd818.
Report an issue: GitHub.
Appendix: source
Thrown at spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/data/SparkOrcWriter.java:221
(row, ordinal) ->
row.getDecimal(ordinal, fieldType.getPrecision(), fieldType.getScale());
break;
case STRING:
case CHAR:
case VARCHAR:
fieldGetter = SpecializedGetters::getUTF8String;
break;
case STRUCT:
fieldGetter = (row, ordinal) -> row.getStruct(ordinal, fieldType.getChildren().size());
break;
case LIST:
fieldGetter = SpecializedGetters::getArray;
break;
case MAP:
fieldGetter = SpecializedGetters::getMap;
break;
default:
throw new IllegalArgumentException(
"Encountered an unsupported ORC type during a write from Spark.");
}
return (row, ordinal) -> {
if (row.isNullAt(ordinal)) {
return null;
}
return fieldGetter.getFieldOrNull(row, ordinal);
};
}
interface FieldGetter<T> extends Serializable {
/**
* Returns a value from a complex Spark data holder such ArrayData, InternalRow, etc... Calls
* the appropriate getter for the expected data type.
*
* @param row Spark's data representationView on GitHub (pinned to 86d9c8fc54)