apache/flink · error · UnsupportedOperationException

Unsupported type: {}

Error message

Unsupported type: {}

What it means

AvroToRowDataConverters.createRowDataConverter refuses TIMESTAMP_WITH_LOCAL_TIME_ZONE when legacyTimestampMapping is true: in legacy mode TIMESTAMP_LTZ is mapped to Avro's timestamp-millis logical type without a timezone, and reading it back into a TIMESTAMP_WITH_LOCAL_TIME_ZONE RowData is unsupported, so converter construction fails fast.

Source

Thrown at flink-formats/flink-avro/src/main/java/org/apache/flink/formats/avro/AvroToRowDataConverters.java:134

            case SMALLINT:
                return avroObject -> ((Integer) avroObject).shortValue();
            case BOOLEAN: // boolean
            case INTEGER: // int
            case INTERVAL_YEAR_MONTH: // long
            case BIGINT: // long
            case INTERVAL_DAY_TIME: // long
            case FLOAT: // float
            case DOUBLE: // double
                return avroObject -> avroObject;
            case DATE:
                return AvroToRowDataConverters::convertToDate;
            case TIME_WITHOUT_TIME_ZONE:
                return AvroToRowDataConverters::convertToTime;
            case TIMESTAMP_WITHOUT_TIME_ZONE:
                return AvroToRowDataConverters::convertToTimestamp;
            case TIMESTAMP_WITH_LOCAL_TIME_ZONE:
                if (legacyTimestampMapping) {
                    throw new UnsupportedOperationException("Unsupported type: " + type);
                } else {
                    return AvroToRowDataConverters::convertToTimestamp;
                }
            case CHAR:
            case VARCHAR:
                return avroObject -> StringData.fromString(avroObject.toString());
            case BINARY:
            case VARBINARY:
                return AvroToRowDataConverters::convertToBytes;
            case DECIMAL:
                return createDecimalConverter((DecimalType) type);
            case ARRAY:
                return createArrayConverter((ArrayType) type, legacyTimestampMapping);
            case ROW:
                return createRowConverter((RowType) type);
            case MAP:
            case MULTISET:
                return createMapConverter(type, legacyTimestampMapping);

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. Disable legacy timestamp mapping (set avro.timestamp.logical-type.mapping.legacy=false / pass legacyTimestampMapping=false) so TIMESTAMP_LTZ maps to Avro local-timestamp types.
  2. Or change the column to TIMESTAMP(6) WITHOUT TIME ZONE if legacy mapping must stay enabled.
  3. Regenerate/adjust the Avro schema so it uses the non-legacy logical types (local-timestamp-millis/micros).

Example fix

// before
AvroRowDataDeserializationSchema deserializer =
    new AvroRowDataDeserializationSchema(rowType, typeInfo, /*legacy*/ true, true, true);

// after
AvroRowDataDeserializationSchema deserializer =
    new AvroRowDataDeserializationSchema(rowType, typeInfo, false, true, true);
Defensive patterns

Strategy: validation

Validate before calling

boolean hasLtz = rowType.getFields().stream()
        .anyMatch(f -> f.getType().is(LogicalTypeRoot.TIMESTAMP_WITH_LOCAL_TIME_ZONE));
if (hasLtz && legacyTimestampMapping) {
    throw new IllegalArgumentException("TIMESTAMP_LTZ unsupported with legacy Avro timestamp mapping");
}

Type guard

static boolean ltzCompatible(RowType t, boolean legacy) {
    return !legacy || t.getFields().stream()
            .noneMatch(f -> f.getType().is(LogicalTypeRoot.TIMESTAMP_WITH_LOCAL_TIME_ZONE));
}

Prevention

When it happens

Trigger: Deserializing an Avro schema/RowType containing TIMESTAMP_WITH_LOCAL_TIME_ZONE while 'avro.timestamp.logical-type.mapping.legacy' (or the constructor flag legacyTimestampMapping) is enabled.

Common situations: Enabling the legacy mapping option for compatibility with old pipelines on a schema that has local-zoned timestamp columns; Flink version upgrades where the default flipped to false.

Related errors


AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14). Data as JSON: /api/errors/ad158564333ca9f1. Report an issue: GitHub.