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 RowToAvroConverter.resolveObject when converting a SeaTunnelRow field value into an Avro object for a type the switch doesn't implement. Serialization counterpart of AvroToRowConverter's check: the row type contains a SqlType the avro format cannot encode into a GenericRecord.

Source

Thrown at seatunnel-formats/seatunnel-format-avro/src/main/java/org/apache/seatunnel/format/avro/RowToAvroConverter.java:158

                SeaTunnelRow seaTunnelRow = (SeaTunnelRow) data;
                SeaTunnelDataType<?>[] fieldTypes =
                        ((SeaTunnelRowType) seaTunnelDataType).getFieldTypes();
                String[] fieldNames = ((SeaTunnelRowType) seaTunnelDataType).getFieldNames();
                Schema recordSchema =
                        SeaTunnelRowTypeToAvroSchemaConverter.buildAvroSchemaWithRowType(
                                (SeaTunnelRowType) seaTunnelDataType);
                GenericRecordBuilder recordBuilder = new GenericRecordBuilder(recordSchema);
                for (int i = 0; i < fieldNames.length; i++) {
                    recordBuilder.set(
                            fieldNames[i], resolveObject(seaTunnelRow.getField(i), fieldTypes[i]));
                }
                return recordBuilder.build();
            default:
                String errorMsg =
                        String.format(
                                "SeaTunnel avro format is not supported for this data type [%s]",
                                seaTunnelDataType.getSqlType());
                throw new SeaTunnelAvroFormatException(
                        AvroFormatErrorCode.UNSUPPORTED_DATA_TYPE, errorMsg);
        }
    }
}

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Identify the unsupported SqlType from the error message and remove/retype that column
  2. Flatten MAP fields or encode them as JSON STRING before conversion
  3. Use a different format (e.g. JSON) for schemas with unsupported types
  4. Upgrade SeaTunnel or contribute a converter branch for the missing type

Example fix

// before
// rowType contains MapType<STRING, INT> -> hits default branch
// after
String json = mapToJson(mapField);
row.setField(i, json); // encode as STRING
Defensive patterns

Strategy: validation

Validate before calling

// validate row type against Avro-supported types before serializing
for (SeaTunnelDataType<?> t : rowType.getFieldTypes()) {
    switch ((SqlType) t.getSqlType()) {
        case STRING: case BOOLEAN: case TINYINT: case SMALLINT: case INT:
        case BIGINT: case FLOAT: case DOUBLE: case BYTES: case ROW:
        case ARRAY: case DATE: case TIMESTAMP: case DECIMAL: case NULL: break;
        default: throw new IllegalArgumentException("Avro-unsupported: " + t.getSqlType());
    }
}

Try / catch

try {
    byte[] bytes = serializationSchema.serialize(row);
} catch (SeaTunnelAvroFormatException e) {
    if (e.getFormatErrorCode() == AvroFormatErrorCode.UNSUPPORTED_DATA_TYPE)
        LOG.error("Cannot encode sqlType, retype or flatten the column", e);
    throw e;
}

Prevention

When it happens

Trigger: Calling AvroSerializationSchema on a row whose SeaTunnelRowType includes a data type not handled in resolveObject's switch (e.g. MAP or other complex types depending on version).

Common situations: Sinking data with MAP/complex columns through the Avro format; upstream schema evolution introducing unsupported types; using avro format where JSON/other format would be appropriate.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/3c383b54846cdf5c. Report an issue: GitHub.