apache/iceberg · error · java.lang.UnsupportedOperationException

Unsupported DistinctType.

Error message

Unsupported DistinctType.

What it means

FlinkTypeVisitor is the Iceberg-Flink type conversion visitor; every visit method must be implemented, but Flink's DayTimeIntervalType and other exotic logical types have no Iceberg equivalent, so the visitor refuses them. This means the table schema being converted to Iceberg contains a logical type Iceberg cannot represent.

Solutions

  1. Replace INTERVAL columns in the Flink schema with a supported type such as BIGINT (millis) or TIMESTAMP before converting to Iceberg
  2. Upgrade to an Iceberg version whose FlinkTypeVisitor maps DayTimeIntervalType to Types.DurationType if available
  3. Filter or cast unsupported columns out of the RowType passed to the converter

Example fix

// before
CREATE TABLE src (d INTERVAL DAY TO SECOND) -- converted -> throws
// after
CREATE TABLE src (d BIGINT) -- store interval as millis, then convert
Defensive patterns

Strategy: validation

Validate before calling

boolean hasInterval(RowType rowType) {
  return rowType.getFields().stream()
    .anyMatch(f -> f.getType() instanceof DayTimeIntervalType);
}
// throw a clear error or cast columns before calling FlinkSchemaUtil.convert

Type guard

boolean isSupported(LogicalType t) {
  return !(t instanceof DayTimeIntervalType);
}

Prevention

When it happens

Trigger: Calling FlinkSchemaUtil.convert() or FlinkTypeConverter.toIcebergType() on a Flink RowType/schema containing a DayTimeIntervalType (INTERVAL DAY TO SECOND) column, e.g. from a source table defined with INTERVAL type columns.

Common situations: Users syncing a Flink SQL table with INTERVAL columns into Iceberg; CDC pipelines ingesting source schemas that include duration types; older Iceberg versions that predate DurationType support in the Iceberg schema.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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

Appendix: source

Thrown at flink/v2.1/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)