apache/iceberg · error · UnsupportedOperationException
Not a supported type: " + targetType
Error message
Not a supported type: " + targetType
What it means
DataConverter.get() maps a pair of Iceberg/Flink logical types to the matching converter (struct, array, or map). When the target type's root is not one of STRUCT, ARRAY, or MAP, the default branch throws UnsupportedOperationException because no row-data conversion exists for that type.
Solutions
- Check the target schema's root type is RowType/STRUCT before invoking get()
- Extend get() with a case for the missing type if support is intended
- Wrap the source data in a RowType so conversion happens at field level
Example fix
// before
DataConverter converter = DataConverter.get(sourceType, targetPrimitiveType);
// after
Types.StructType wrapped = Types.StructType.of(
Types.NestedField.optional(1, "value", targetPrimitiveType));
DataConverter converter = DataConverter.get(
wrapInStruct(sourceType), wrapInStruct(wrapped)); Defensive patterns
Strategy: validation
Validate before calling
if (targetType.typeId() != Types.StructType.class
&& sourceType.typeId() != TypeID.STRUCT
&& sourceType.typeId() != TypeID.LIST
&& sourceType.typeId() != TypeID.MAP) {
throw new IllegalArgumentException("Unsupported root type: " + targetType);
} Type guard
boolean isSupported(Type type) {
switch (type.typeId()) {
case STRUCT:
case LIST:
case MAP:
return true;
default:
return false;
}
} Prevention
- Validate target schema root types before building the dynamic sink
- Keep schemas nested under RowType/StructType for DataConverter paths
When it happens
Trigger: Calling DataConverter.get(sourceType, targetType) where targetType resolves to a primitive, varbinary, or otherwise non-nested root type in the dynamic Flink sink's schema evolution path.
Common situations: Writing to an Iceberg table whose schema contains a top-level column type the converter does not handle, or accidentally passing a primitive type instead of a RowType when building the dynamic sink.
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
- Can not alter the default database when the iceberg catalog…
- Cannot apply unknown modify-column change:
- Cannot apply unknown modify-column-position change:
- Cannot apply unknown table change:
- Cannot apply unknown unique constraint:
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/b180fa0ecfcabc83.
Report an issue: GitHub.
Appendix: source
Thrown at flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/DataConverter.java:127
};
case TIMESTAMP_WITHOUT_TIME_ZONE:
return object -> {
if (object instanceof Integer) {
LocalDateTime dateTime =
LocalDateTime.of(LocalDate.ofEpochDay((Integer) object), LocalTime.MIN);
return TimestampData.fromLocalDateTime(dateTime);
} else {
return object;
}
};
case ROW:
return new RowDataConverter((RowType) sourceType, (RowType) targetType);
case ARRAY:
return new ArrayConverter((ArrayType) sourceType, (ArrayType) targetType);
case MAP:
return new MapConverter((MapType) sourceType, (MapType) targetType);
default:
throw new UnsupportedOperationException("Not a supported type: " + targetType);
}
}
static DataConverter nullable(DataConverter converter) {
return value -> value == null ? null : converter.convert(value);
}
class RowDataConverter implements DataConverter {
private final RowData.FieldGetter[] fieldGetters;
private final DataConverter[] dataConverters;
RowDataConverter(RowType sourceType, RowType targetType) {
this.fieldGetters = new RowData.FieldGetter[targetType.getFields().size()];
this.dataConverters = new DataConverter[targetType.getFields().size()];
for (int i = 0; i < targetType.getFields().size(); i++) {
RowData.FieldGetter fieldGetter;
DataConverter dataConverter;View on GitHub (pinned to 86d9c8fc54)