apache/seatunnel · error · SeaTunnelAvroFormatException
UNSUPPORTED_DATA_TYPE
UNSUPPORTED_DATA_TYPE
Error message
SeaTunnel avro format is not supported for this data type [${sqlType}] What it means
SeaTunnelAvroFormatException with code UNSUPPORTED_DATA_TYPE thrown by AvroToRowConverter.convertField when it encounters a SeaTunnel SQL type it cannot map from Avro to a Row field. The switch over dataType falls into the default branch for types the avro format does not handle (e.g. MAP, some TIME/ARRAY variants depending on version).
Source
Thrown at seatunnel-formats/seatunnel-format-avro/src/main/java/org/apache/seatunnel/format/avro/AvroToRowConverter.java:142
for (Object o : map.entrySet()) {
res.put(
convertField(mapType.getKeyType(), ((Map.Entry) o).getKey()),
convertField(mapType.getValueType(), ((Map.Entry) o).getValue()));
}
return res;
case ARRAY:
SeaTunnelDataType<?> basicType = ((ArrayType<?, ?>) dataType).getElementType();
List<Object> list = (List<Object>) val;
return convertArray(list, basicType);
case ROW:
SeaTunnelRowType subRow = (SeaTunnelRowType) dataType;
return converter((GenericRecord) val, subRow);
default:
String errorMsg =
String.format(
"SeaTunnel avro format is not supported for this data type [%s]",
dataType.getSqlType());
throw new SeaTunnelAvroFormatException(
AvroFormatErrorCode.UNSUPPORTED_DATA_TYPE, errorMsg);
}
}
protected Object convertArray(List<Object> val, SeaTunnelDataType<?> dataType) {
if (val == null) {
return null;
}
int length = val.size();
Object instance = Array.newInstance(dataType.getTypeClass(), length);
for (int i = 0; i < val.size(); i++) {
Array.set(instance, i, convertField(dataType, val.get(i)));
}
return instance;
}
}
View on GitHub (pinned to cf67b549a7)
Solutions
- Check which SqlType hit the default branch (in the error message) and avoid that type in the row type for Avro format
- Convert unsupported fields to STRING before Avro serialization
- Upgrade to a SeaTunnel version with broader Avro type coverage
- Extend convertField to handle the type if you control the code
Example fix
// before
SeaTunnelRowType rowType = new SeaTunnelRowType(new String[]{"m"}, new SeaTunnelDataType<?>[]{new MapType<>(STRING_TYPE, INT_TYPE)});
// after
SeaTunnelRowType rowType = new SeaTunnelRowType(new String[]{"m"}, new SeaTunnelDataType<?>[]{STRING_TYPE}); // serialize map as JSON string Defensive patterns
Strategy: validation
Validate before calling
import static org.apache.seatunnel.api.table.type.BasicType.*;
// check row types are Avro-decodable before use
for (SeaTunnelDataType<?> t : rowType.getFieldTypes()) {
if (!(t == STRING_TYPE || t == INT_TYPE || t == LONG_TYPE || /* supported set */ ...))
throw new IllegalArgumentException("Avro format unsupported type: " + t.getSqlType());
} Try / catch
try {
row = avroToRowConverter.converter(record, rowType);
} catch (SeaTunnelAvroFormatException e) {
if (e.getFormatErrorCode() == AvroFormatErrorCode.UNSUPPORTED_DATA_TYPE) {
LOG.error("Unsupported sqlType reading Avro: {}", e.getMessage());
}
throw e;
} Prevention
- Restrict Avro-format tables to primitive supported types
- Convert MAP/complex columns to JSON STRING before the format layer
- Verify type coverage for your SeaTunnel version before choosing avro format
When it happens
Trigger: Deserializing an Avro GenericRecord into a SeaTunnelRow whose SeaTunnelRowType contains a data type not implemented in convertField's switch — reading back data written with a richer schema than the converter supports.
Common situations: Using Avro format with tables containing MAP or complex types not supported by the converter; schema drift after adding new columns of unsupported types; version mismatch between writer and reader SeaTunnel versions.
Related errors
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/d4f625d57b121b5b.
Report an issue: GitHub.