apache/iceberg · error · UnsupportedOperationException
Unsupported type
Error message
Unsupported type: %s
What it means
BaseParquetWriters' primitive() maps Iceberg primitive types to Parquet value writers and throws UnsupportedOperationException for primitives it cannot write. It indicates the writer has no serialization path for the requested Parquet primitive.
Solutions
- Upgrade Iceberg to a version with writer support for that primitive type.
- Remove or convert the unsupported column before writing (e.g. cast/serialize as string/binary).
- Route the write through the appropriate writer implementation for your engine if the generic writer lacks the type.
Example fix
// before GenericParquetWriter.write(fileSchema, schema, ...); // throws for unknown primitive // after: drop/cast unsupported column schema = new Schema(schema.columns().stream().filter(f -> f.type().typeId() != TypeID.UNKNOWN).toList());
Defensive patterns
Strategy: validation
Validate before calling
// Reject unsupported primitives before writing
for (Types.NestedField f : schema.columns()) {
switch (f.type().typeId()) {
case UNKNOWN: case GEOMETRY: case GEOGRAPHY:
throw new IllegalArgumentException("Type not writable here: " + f.type());
default: // ok
}
} Prevention
- Match writer version to schema features (e.g. don't enable variant/geometry without support)
- Cast exotic types to supported ones before writing
- Test write paths against the full schema in CI
When it happens
Trigger: Writing (GenericParquetWriter / Spark writers built on BaseParquetWriters) a column whose resolved primitive type falls into the default branch of the switch — a primitive type with no registered writer.
Common situations: New Iceberg types (e.g. geometry/geography/unknown) written with a writer version lacking support; custom schemas with exotic primitives; using generic writers where engine-specific writers are required.
Related errors
- Unsupported primitive type
- Avro writer does not support variant types
- Byte stream split encoding is not supported for type " +…
- Cannot convert unknown primitive type
- Cannot decode dictionary of type
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/e7725285f319dcac.
Report an issue: GitHub.
Appendix: source
Thrown at parquet/src/main/java/org/apache/iceberg/data/parquet/BaseParquetWriter.java:160
}
switch (primitive.getPrimitiveTypeName()) {
case FIXED_LEN_BYTE_ARRAY:
return fixedWriter(desc);
case BINARY:
return ParquetValueWriters.byteBuffers(desc);
case BOOLEAN:
return ParquetValueWriters.booleans(desc);
case INT32:
return ParquetValueWriters.ints(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);
}
}
@Override
public ParquetValueWriter<?> variant(
Types.VariantType iVariant, GroupType variant, ParquetValueWriter<?> result) {
return result;
}
@Override
public ParquetVariantVisitor<ParquetValueWriter<?>> variantVisitor() {
return new VariantWriterBuilder(type, Arrays.asList(currentPath()));
}
}
private class LogicalTypeWriterVisitor
implements LogicalTypeAnnotation.LogicalTypeAnnotationVisitor<ParquetValueWriter<?>> {
private final ColumnDescriptor desc;View on GitHub (pinned to 86d9c8fc54)