apache/iceberg · error · UnsupportedOperationException
Unsupported to derive Schema for type:
Error message
Unsupported to derive Schema for type:
What it means
Thrown when converting a Flink TIMESTAMP_WITH_LOCAL_TIME_ZONE logical type to an Avro schema while legacyTimestampMapping=true. Legacy mapping has no Avro logical type for zoned timestamps, so this case is explicitly rejected with UnsupportedOperationException. Using the non-legacy mapping (timestampMillis/timestampMicros) resolves it.
Source
Thrown at flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/formats/avro/typeutils/AvroSchemaConverter.java:511
}
} else {
if (precision <= 3) {
avroLogicalType = LogicalTypes.localTimestampMillis();
} else if (precision <= 6) {
avroLogicalType = LogicalTypes.localTimestampMicros();
} else {
throw new IllegalArgumentException(
"Avro does not support LOCAL TIMESTAMP type "
+ "with precision: "
+ precision
+ ", it only supports precision less than 6.");
}
}
Schema timestamp = avroLogicalType.addToSchema(SchemaBuilder.builder().longType());
return nullable ? nullableSchema(timestamp) : timestamp;
case TIMESTAMP_WITH_LOCAL_TIME_ZONE:
if (legacyTimestampMapping) {
throw new UnsupportedOperationException(
"Unsupported to derive Schema for type: " + logicalType);
} else {
final LocalZonedTimestampType localZonedTimestampType =
(LocalZonedTimestampType) logicalType;
precision = localZonedTimestampType.getPrecision();
if (precision <= 3) {
avroLogicalType = LogicalTypes.timestampMillis();
} else if (precision <= 6) {
avroLogicalType = LogicalTypes.timestampMicros();
} else {
throw new IllegalArgumentException(
"Avro does not support TIMESTAMP type "
+ "with precision: "
+ precision
+ ", it only supports precision less than 6.");
}
timestamp = avroLogicalType.addToSchema(SchemaBuilder.builder().longType());
return nullable ? nullableSchema(timestamp) : timestamp;View on GitHub (pinned to 86d9c8fc54)
Solutions
- Set legacyTimestampMapping=false when calling convertToSchema.
- Remove the legacy timestamp mapping option from the connector/format config.
- If legacy mode cannot be disabled, cast the column to TIMESTAMP (without time zone).
- Upgrade Flink/Iceberg if legacy mapping is forced by an old version's defaults.
Example fix
// before AvroSchemaConverter.convertToSchema(localZonedTimestampType, true); // throws // after AvroSchemaConverter.convertToSchema(localZonedTimestampType, false); // timestampMillis/Micros
Defensive patterns
Strategy: validation
Validate before calling
if (logicalType instanceof LocalZonedTimestampType && legacyTimestampMapping) { /* disable legacy mapping or cast to TIMESTAMP without time zone */ } Prevention
- Never enable legacy timestamp mapping if the schema contains zoned timestamps.
- Remove deprecated legacy-mapping flags from connector configs.
- Audit schemas for TIMESTAMPTZ columns before choosing Avro options.
- Cast TIMESTAMPTZ to TIMESTAMP if legacy mode is unavoidable.
When it happens
Trigger: Calling AvroSchemaConverter.convertToSchema(LogicalType, boolean) with a LocalZonedTimestampType while legacyTimestampMapping is true.
Common situations: Tables containing TIMESTAMPTZ / TIMESTAMP WITH LOCAL TIME ZONE columns written to Avro with legacy mapping enabled from an older Flink/Iceberg configuration.
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: ${type}
- Unsupported type: ${type}
- Unsupported to derive Schema for type: ${logicalType}
- Unsupported type: " + type
- Unsupported type: " + type
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/0c7c1d1595a47839.
Report an issue: GitHub.