apache/iceberg · error · UnsupportedOperationException

Unsupported DistinctType.

Error message

Unsupported DistinctType.

What it means

FlinkTypeVisitor.visit(DistinctType) throws UnsupportedOperationException because Iceberg has no notion of Flink's user-defined DISTINCT structured types. Schema conversion rejects them rather than guessing a base type.

Solutions

  1. Flatten the distinct type to its underlying built-in type in the DDL.
  2. Replace the distinct type with the raw physical type (e.g. VARCHAR, INT) before conversion.
  3. Customize the visitor to unwrap distinct types to their source type if acceptable.

Example fix

// before
CREATE DISTINCT TYPE user_id AS INT;
column user_id;
// after
column INT user_id;
Defensive patterns

Strategy: type-guard

Validate before calling

if (dataType.getLogicalType() instanceof DistinctType) {
  throw new IllegalArgumentException("Flatten DISTINCT types to base types for Iceberg");
}

Prevention

When it happens

Trigger: Converting a Flink schema/catalog type graph containing a user-declared CREATE DISTINCT TYPE when mapping to Iceberg types.

Common situations: Rare; encountered when DDLs ported from catalogs with UDT support (or Spark/Hive-style distinct types) are used with Iceberg Flink tables.

Understand the failure class

Background: "is not a compatible type" / "cannot merge" errors: when a value's type doesn't match what the library requires — this error's family across 65 libraries.

Related errors


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

Appendix: source

Thrown at flink/v2.2/flink/src/main/java/org/apache/iceberg/flink/FlinkTypeVisitor.java:53

  @Override
  public T visit(ZonedTimestampType zonedTimestampType) {
    throw new UnsupportedOperationException("Unsupported ZonedTimestampType.");
  }

  @Override
  public T visit(YearMonthIntervalType yearMonthIntervalType) {
    throw new UnsupportedOperationException("Unsupported YearMonthIntervalType.");
  }

  @Override
  public T visit(DayTimeIntervalType dayTimeIntervalType) {
    throw new UnsupportedOperationException("Unsupported DayTimeIntervalType.");
  }

  @Override
  public T visit(DistinctType distinctType) {
    throw new UnsupportedOperationException("Unsupported DistinctType.");
  }

  @Override
  public T visit(StructuredType structuredType) {
    throw new UnsupportedOperationException("Unsupported StructuredType.");
  }

  @Override
  public T visit(NullType nullType) {
    throw new UnsupportedOperationException("Unsupported NullType.");
  }

  @Override
  public T visit(RawType<?> rawType) {
    throw new UnsupportedOperationException("Unsupported RawType.");
  }

  @Override

View on GitHub (pinned to 86d9c8fc54)