apache/iceberg · error · UnsupportedOperationException

Unsupported type: ${type}

Error message

Unsupported type: ${type}

What it means

AvroToRowDataConverters.createConverter maps Flink LogicalTypes to Avro→RowData converters. TIMESTAMP_WITH_LOCAL_TIME_ZONE is only supported when legacy timestamp-to-atomic mapping is disabled; with table property format-version/timestamp mapping set to legacy (read.timestamp-unit legacy / avro timestamp mapping), it throws UnsupportedOperationException.

Source

Thrown at flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/formats/avro/AvroToRowDataConverters.java:139

        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:
        // Iceberg: Added support for nanoseconds precision (FLINK-39251)
        return avroObject -> convertToTimestamp(avroObject, type);
      case TIMESTAMP_WITH_LOCAL_TIME_ZONE:
        if (legacyTimestampMapping) {
          throw new UnsupportedOperationException("Unsupported type: " + type);
        } else {
          // Iceberg: Added support for nanoseconds precision (FLINK-39251)
          return avroObject -> convertToTimestamp(avroObject, type);
        }
      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:

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Disable legacy timestamp mapping: rewrite the table (e.g. via Spark procedure rewrite or table property) so timestamptz columns use the modern Avro logical type mapping.
  2. Set the table property 'timestamp-without-time-zone-avro-mapping' / related avro mapping properties to the non-legacy (int64 micros) scheme and rewrite data files.
  3. Avoid timestamptz columns in the affected table, or cast them to timestamp-without-time-zone in the query.
  4. If the legacy mapping is required, use a reader/writer version that predates or supports the legacy path.

Example fix

// before (legacy mapping enabled)
table.updateProperties().set("timestamp-without-time-zone-avro-mapping", "legacy-micros").commit();
// after
table.updateProperties().set("timestamp-without-time-zone-avro-mapping", "adjusted-micros").commit();
Defensive patterns

Strategy: validation

Validate before calling

if (type instanceof TimestampType && ((TimestampType) type).isLocal() && legacyTimestampMapping) {
  throw new IllegalArgumentException("legacyTimestampMapping not allowed with timestamptz column");
}

Try / catch

try { avroReader.open(); } catch (UnsupportedOperationException e) { // legacy mapping conflict: rewrite table or drop mapping property }

Prevention

When it happens

Trigger: Reading an Avro-encoded Iceberg table with a TIMESTAMP_WITH_LOCAL_TIME_ZONE (timestamptz) column while legacyTimestampMapping is true (table property 'format-version'=1 timestamp mapping or timestamp-without-time-zone-avro-mapping set to legacy).

Common situations: Older tables written before timestamptz-in-avro support, or tables configured with legacy avro timestamp mapping, read by newer flink iceberg readers that require modern mapping.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/8bc8b337aad7ebdb. Report an issue: GitHub.