apache/seatunnel · error · UnsupportedOperationException

Unsupported to derive Schema for type: ${dataType}

Error message

Unsupported to derive Schema for type: ${dataType}

What it means

AvroSchemaConverter.convertToSchema() maps SeaTunnel data types to Avro schemas. The default branch throws UnsupportedOperationException when it encounters a SeaTunnel type with no Avro mapping implemented. Recursion through nested types (array/map/row) means a deeply nested unsupported type also triggers this.

Source

Thrown at seatunnel-connectors-v2/connector-hudi/src/main/java/org/apache/seatunnel/connectors/seatunnel/hudi/sink/convert/AvroSchemaConverter.java:163

            case MAP:
                Schema map =
                        SchemaBuilder.builder()
                                .map()
                                .values(
                                        convertToSchema(
                                                extractValueTypeToAvroMap(dataType),
                                                rowName,
                                                true));
                return nullableSchema(map);
            case ARRAY:
                ArrayType<?, ?> arrayType = (ArrayType<?, ?>) dataType;
                Schema array =
                        SchemaBuilder.builder()
                                .array()
                                .items(convertToSchema(arrayType.getElementType(), rowName, true));
                return nullableSchema(array);
            default:
                throw new UnsupportedOperationException(
                        "Unsupported to derive Schema for type: " + dataType);
        }
    }

    public static SeaTunnelDataType<?> extractValueTypeToAvroMap(SeaTunnelDataType<?> type) {
        SeaTunnelDataType<?> keyType;
        SeaTunnelDataType<?> valueType;
        MapType<?, ?> mapType = (MapType<?, ?>) type;
        keyType = mapType.getKeyType();
        valueType = mapType.getValueType();
        if (keyType.getSqlType() != SqlType.STRING) {
            throw new UnsupportedOperationException(
                    "Avro format doesn't support non-string as key type of map. "
                            + "The key type is: "
                            + keyType.getSqlType());
        }
        return valueType;
    }

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Cast or transform the offending column to a supported type in an upstream transform (e.g. cast to STRING) before the Hudi sink.
  2. Check the AvroSchemaConverter switch for supported SqlTypes and drop unsupported columns via a Filter transform.
  3. Upgrade SeaTunnel/connector-hudi to a version that supports the offending type.
  4. If support exists but should be added, extend the switch in AvroSchemaConverter with a SchemaBuilder mapping.

Example fix

// before (unhandled type flows to sink)
source -> Hudi sink

// after
source -> Sql{ transform = "cast(unhandled_col as string)" } -> Hudi sink
Defensive patterns

Strategy: validation

Validate before calling

catalogTable.getTableSchema().toPhysicalRowDataType()
    .getChildren()
    .forEach(t -> checkSupported(t.getSqlType())); // reject types missing in AvroSchemaConverter switch

Type guard

static boolean isAvroConvertible(SeaTunnelDataType<?> t) {
    switch (t.getSqlType()) {
        case ROW: return ((SeaTunnelRowType) t).getFields().length > 0
            && Arrays.stream(((SeaTunnelRowType) t).getFieldTypes())
                .allMatch(AvroSchemaConverter::isAvroConvertible);
        case MAP: return isAvroConvertible(((MapType<?, ?>) t).getValueType());
        case ARRAY: return isAvroConvertible(((ArrayType<?, ?>) t).getElementType());
        default: return Arrays.asList(SqlType.STRING, SqlType.BOOLEAN, SqlType.TINYINT,
            SqlType.SMALLINT, SqlType.INT, SqlType.BIGINT, SqlType.FLOAT, SqlType.DOUBLE,
            SqlType.DATE, SqlType.TIMESTAMP, SqlType.BYTES).contains(t.getSqlType());
    }
}

Try / catch

try {
    Schema s = AvroSchemaConverter.convertToSchema(rowType, "rowName");
} catch (UnsupportedOperationException e) {
    // identify unsupported field, cast/drop it upstream, then retry conversion
}

Prevention

When it happens

Trigger: Writing a SeaTunnel row containing a field (possibly nested inside arrays, maps, or rows) whose SeaTunnelType (e.g. certain Time/Interval/bytes variants not handled in the switch) has no case in the converter when building the Hudi write schema.

Common situations: Upstream tables containing exotic column types (e.g. network addresses, arrays of unhandled types) being synced to Hudi; schema evolution introducing a new SeaTunnel type; version drift where the connector predates support for a SeaTunnel API type.

Related errors


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