apache/iceberg · error · UnsupportedOperationException
Unsupported type: " + type
Error message
Unsupported type: " + type
What it means
RowDataToAvroConverters.createConverter (public) builds RowData-to-Avro converters. For TIMESTAMP_WITH_LOCAL_TIME_ZONE with legacyTimestampMapping=true, no Avro encoder path exists, so it throws UnsupportedOperationException("Unsupported type: " + type). Legacy timestamp mapping cannot serialize local-zoned timestamps to Avro.
Source
Thrown at flink/v2.2/flink/src/main/java/org/apache/iceberg/flink/formats/avro/RowDataToAvroConverters.java:223
} else {
// Iceberg: Added support for nanoseconds precision (FLINK-39251)
return instant.getEpochSecond() * 1_000_000_000L + instant.getNano();
}
}
};
}
break;
// Iceberg: Added support for nanoseconds precision (FLINK-39251)
case TIMESTAMP_WITH_LOCAL_TIME_ZONE:
final int ltzPrecision;
if (type instanceof org.apache.flink.table.types.logical.LocalZonedTimestampType) {
ltzPrecision =
((org.apache.flink.table.types.logical.LocalZonedTimestampType) type).getPrecision();
} else {
ltzPrecision = 3;
}
if (legacyTimestampMapping) {
throw new UnsupportedOperationException("Unsupported type: " + type);
} else {
converter =
new RowDataToAvroConverter() {
private static final long serialVersionUID = 1L;
@Override
public Object convert(Schema schema, Object object) {
TimestampData timestampData = (TimestampData) object;
if (ltzPrecision <= 3) {
return timestampData.getMillisecond();
} else if (ltzPrecision <= 6) {
return timestampData.getMillisecond() * 1000L
+ timestampData.getNanoOfMillisecond() / 1000;
} else {
// Iceberg: Added support for nanoseconds precision (FLINK-39251)
return timestampData.getMillisecond() * 1_000_000L
+ timestampData.getNanoOfMillisecond();
}View on GitHub (pinned to 86d9c8fc54)
Solutions
- Disable legacy timestamp mapping so the non-legacy LTZ converter is used.
- Change the column to TIMESTAMP_WITHOUT_TIME_ZONE if timezone semantics allow.
- Convert the RowData field (e.g. to a long epoch value) before Avro serialization.
Example fix
// before // legacyTimestampMapping=true, column TIMESTAMP_WITH_LOCAL_TIME_ZONE(6) // after // set legacy timestamp mapping off (or use DataTypes.TIMESTAMP_WITHOUT_TIME_ZONE(6))
Defensive patterns
Strategy: validation
Validate before calling
// before writing, reject LTZ columns under legacy mapping
if (legacyTimestampMapping && rowType.getTypeAt(i) instanceof LocalZonedTimestampType) { throw new IllegalArgumentException("Disable legacy timestamp mapping to write TIMESTAMP_WITH_LOCAL_TIME_ZONE to Avro"); } Try / catch
try { avroConverter.convert(rowData); } catch (UnsupportedOperationException e) { /* disable legacy mapping or convert the column first */ } Prevention
- Turn off legacy timestamp mapping for any job writing LTZ columns to Avro.
- Migrate legacy table options during upgrades.
- Prefer TIMESTAMP(ltz=false) or long-epoch fields under legacy configs.
When it happens
Trigger: Writing RowData to Avro (e.g. Avro serialization format or Iceberg Avro file writer) when the schema contains TIMESTAMP_WITH_LOCAL_TIME_ZONE and legacy timestamp mapping is enabled — the ltzPrecision lookup shows the type reached the LTZ branch but legacy mode is on.
Common situations: Jobs configured with legacy timestamp mapping (pre-FLIP-278 options) writing timestamp-with-local-time-zone columns; tables/options migrated from older Flink versions retaining legacy config.
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 to derive Schema for type:
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/dead7c209bfb4c52.
Report an issue: GitHub.