apache/iceberg · error · UnsupportedOperationException
Unsupported to derive Schema for type: <logicalType>
Error message
Unsupported to derive Schema for type: <logicalType>
What it means
convertToSchema only implements Avro schema derivation for a known set of Flink logical types. RAW (and any unmatched type) has no Avro representation rule, so the converter throws UnsupportedOperationException instead of guessing a schema.
Source
Thrown at flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/formats/avro/typeutils/AvroSchemaConverter.java:593
Schema record = builder.endRecord();
return nullable ? nullableSchema(record) : record;
case MULTISET:
case MAP:
Schema map =
SchemaBuilder.builder()
.map()
.values(convertToSchema(extractValueTypeToAvroMap(logicalType), rowName));
return nullable ? nullableSchema(map) : map;
case ARRAY:
ArrayType arrayType = (ArrayType) logicalType;
Schema array =
SchemaBuilder.builder()
.array()
.items(convertToSchema(arrayType.getElementType(), rowName));
return nullable ? nullableSchema(array) : array;
case RAW:
default:
throw new UnsupportedOperationException(
"Unsupported to derive Schema for type: " + logicalType);
}
}
public static LogicalType extractValueTypeToAvroMap(LogicalType type) {
LogicalType keyType;
LogicalType valueType;
if (type instanceof MapType) {
MapType mapType = (MapType) type;
keyType = mapType.getKeyType();
valueType = mapType.getValueType();
} else {
MultisetType multisetType = (MultisetType) type;
keyType = multisetType.getElementType();
valueType = new IntType();
}
if (!keyType.is(LogicalTypeFamily.CHARACTER_STRING)) {
throw new UnsupportedOperationException(View on GitHub (pinned to 86d9c8fc54)
Solutions
- Remove or replace RAW-typed columns before conversion (e.g. deserialize to a supported type with a Map/projection).
- If the RAW payload is actually a known structure, declare the field with its concrete LogicalType instead of RAW.
- Check that you are using a Flink/Iceberg version combination where the converter supports your type; upgrade iceberg-flink-runtime if a newer release added support.
Example fix
// before Schema s = AvroSchemaConverter.convertToSchema(new RawType<>(MyPojo.class)); // after: use a concrete supported type Schema s = AvroSchemaConverter.convertToSchema(new RowType(...));
Defensive patterns
Strategy: type-guard
Validate before calling
// reject unsupported types up-front
Set<LogicalTypeRoot> supported = Set.of(ROW, ARRAY, MAP, MULTISET, CHAR, VARCHAR, BOOLEAN, INTEGER, BIGINT, DECIMAL, FLOAT, DOUBLE, DATE, TIME_WITHOUT_TIME_ZONE, TIMESTAMP_WITHOUT_TIME_ZONE, TIMESTAMP_WITH_LOCAL_TIME_ZONE, BINARY, VARBINARY);
if (!supported.contains(type.getTypeRoot())) {
throw new IllegalArgumentException("Type not Avro-convertible: " + type.asSummaryString());
} Type guard
boolean isAvroConvertible(LogicalType t) {
return t.getTypeRoot() != LogicalTypeRoot.RAW;
} Try / catch
try {
schema = AvroSchemaConverter.convertToSchema(logicalType);
} catch (UnsupportedOperationException e) {
// fall back to a generic/bytes schema or drop the field
schema = fallbackSchema(logicalType);
} Prevention
- Avoid RAW-typed fields in streams destined for Avro sinks
- Map custom POJOs to concrete Row types before serialization
- Pin compatible Flink/Iceberg versions and check the converter's supported types when upgrading
When it happens
Trigger: Calling convertToSchema on a LogicalType whose case is RAW or any type not handled by the switch (e.g. a RawType from a custom serializer, or newly added Flink types this converter does not know).
Common situations: DataStreams containing RAW-typed columns (e.g. from DataStream API with custom TypeInformations), or Flink version upgrades introducing new logical types while using an older Iceberg AvroSchemaConverter.
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 type ID:
- Unsupported type: ${primitive}
- Unsupported Avro type '${schema.getType()}'.
- Avro does not support TIME type with precision: <precision>,
- Avro format doesn't support non-string as key type of map. T
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/f2a196dffb35d542.
Report an issue: GitHub.