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 SeaTunnelRowTypeToAvroDataTypeConverter.seaTunnelDataType2AvroDataType when building the Avro schema from a SeaTunnelRowType containing a type with no Avro mapping. Schema construction fails before any data is written, so jobs fail at setup rather than mid-stream.

Source

Thrown at seatunnel-formats/seatunnel-format-avro/src/main/java/org/apache/seatunnel/format/avro/SeaTunnelRowTypeToAvroSchemaConverter.java:126

                        Schema.create(Schema.Type.NULL),
                        decimal.addToSchema(Schema.create(Schema.Type.BYTES)));
            case TIMESTAMP:
                return Schema.createUnion(
                        Schema.create(Schema.Type.NULL),
                        LogicalTypes.localTimestampMillis()
                                .addToSchema(Schema.create(Schema.Type.LONG)));
            case DATE:
                return Schema.createUnion(
                        Schema.create(Schema.Type.NULL),
                        LogicalTypes.date().addToSchema(Schema.create(Schema.Type.INT)));
            case NULL:
                return Schema.create(Schema.Type.NULL);
            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. Check the unsupported SqlType in the message and change the column to a supported type
  2. Cast/convert the offending column (e.g. to STRING or a primitive) upstream of the format
  3. Upgrade to a SeaTunnel release that supports the type in Avro schema conversion
  4. Extend the converter switch if working in-tree

Example fix

// before
new SeaTunnelRowType(new String[]{"tm"}, new SeaTunnelDataType<?>[]{new MapType<>(STRING_TYPE, STRING_TYPE)});
// after
new SeaTunnelRowType(new String[]{"tm"}, new SeaTunnelDataType<?>[]{STRING_TYPE}); // map serialized as JSON string
Defensive patterns

Strategy: validation

Validate before calling

// fail fast at schema generation time
try {
    Schema s = SeaTunnelRowTypeToAvroSchemaConverter.generateValidSchema(rowType, "name", "ns");
} catch (SeaTunnelAvroFormatException e) {
    throw new IllegalArgumentException("Retype unsupported column: " + e.getMessage());
}

Try / catch

try {
    schema = SeaTunnelRowTypeToAvroSchemaConverter.generateValidSchema(rowType, name, ns);
} catch (SeaTunnelAvroFormatException e) {
    LOG.error("Avro schema generation failed for type: {}", e.getMessage());
    throw e; // schema errors should fail setup, not be retried
}

Prevention

When it happens

Trigger: Generating an Avro schema for a SeaTunnelRowType whose field list includes a SqlType not covered by seaTunnelDataType2AvroDataType's switch (e.g. MAP, or time types depending on version); commonly via generateValidSchema during serialization setup.

Common situations: Configuring an Avro sink/format for a table with complex column types; schema drift after adding columns of new types; older SeaTunnel versions with narrower Avro type support.

Related errors


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