apache/iceberg · error · UnsupportedOperationException
Unsupported type: {primitive}
Error message
Unsupported type: {primitive} What it means
SparkParquetWriters.primitive maps Spark/ Iceberg primitive types to Parquet writers; only known physical types (INT32/INT64/FLOAT/DOUBLE/etc.) are handled. The default branch throws UnsupportedOperationException when a column's Parquet primitive type has no matching writer.
Source
Thrown at spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/data/SparkParquetWriters.java:328
"Unsupported logical type: " + primitive.getLogicalTypeAnnotation()));
}
switch (primitive.getPrimitiveTypeName()) {
case FIXED_LEN_BYTE_ARRAY:
case BINARY:
return byteArrays(desc);
case BOOLEAN:
return ParquetValueWriters.booleans(desc);
case INT32:
return ints(sType, desc);
case INT64:
return ParquetValueWriters.longs(desc);
case FLOAT:
return ParquetValueWriters.floats(desc);
case DOUBLE:
return ParquetValueWriters.doubles(desc);
default:
throw new UnsupportedOperationException("Unsupported type: " + primitive);
}
}
}
private static PrimitiveWriter<?> ints(DataType type, ColumnDescriptor desc) {
if (type instanceof ByteType) {
return ParquetValueWriters.tinyints(desc);
} else if (type instanceof ShortType) {
return ParquetValueWriters.shorts(desc);
}
return ParquetValueWriters.ints(desc);
}
private static PrimitiveWriter<UTF8String> utf8Strings(ColumnDescriptor desc) {
return new UTF8StringWriter(desc);
}
private static PrimitiveWriter<UTF8String> uuids(ColumnDescriptor desc) {View on GitHub (pinned to 86d9c8fc54)
Solutions
- Upgrade the iceberg-spark module to match your table spec version so new types have writers.
- Exclude or retype unsupported columns (e.g. cast to string) before writing.
- Inspect the generated Parquet schema (write.parquet) to confirm which column maps to the unsupported primitive.
Defensive patterns
Strategy: validation
Validate before calling
// before writing, confirm every Iceberg type in the schema has a Parquet writer mapping in your Iceberg version
schema.columns().forEach(c -> Preconditions.checkArgument(
!c.type().equals(Types.UUID.get()), // example: type absent in old writers
"Type %s may not be writable with this iceberg-spark version", c.type())); Prevention
- Match table format-version features to the iceberg-spark release in use
- Avoid newer Iceberg types (uuid, variant) until your writer version supports them
- Run a small write test after schema evolution
When it happens
Trigger: Writing data where a column descriptor's Parquet primitive type is not one of the types handled in the switch — usually from a schema mapping that produced an exotic physical type (e.g. certain fixed-byte or binary cases unhandled by this writer path).
Common situations: Schema evolution producing unexpected physical layouts; using an older Iceberg Spark writer with newer Iceberg types (e.g. uuid, variant) not mapped in this version.
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
- Unsupported base type for decimal:
- Unsupported base type for decimal: ${primitive.getPrimitiveT
- Unsupported type: ${primitive}
- Unsupported type: ${primitive}
- Unsupported type:
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/5c24e9b0f58983cb.
Report an issue: GitHub.