apache/iceberg · error · java.lang.UnsupportedOperationException

Unsupported DayTimeIntervalType.

Error message

Unsupported DayTimeIntervalType.

What it means

FlinkTypeVisitor's default visit(DayTimeIntervalType) throws UnsupportedOperationException because Flink's INTERVAL DAY/SECOND types have no Iceberg equivalent. Any conversion traversing such a type aborts with this error.

Solutions

  1. Cast the interval to BIGINT (e.g. milliseconds) or STRING before writing to Iceberg.
  2. Derive the interval on the fly from two TIMESTAMP columns at read time.
  3. Override visit(DayTimeIntervalType) in a custom visitor with an explicit mapping.

Example fix

// before
CREATE TABLE t (lag INTERVAL DAY TO SECOND) -- iceberg sink
// after
CREATE TABLE t (lag_ms BIGINT) -- TIMESTAMPDIFF/epoch millis
Defensive patterns

Strategy: validation

Validate before calling

schema.getColumns().forEach(c -> {
  if (c.getDataType().getLogicalType() instanceof DayTimeIntervalType) {
    throw new IllegalArgumentException("Interval DAY/SECOND not supported by Iceberg: " + c.getName());
  }
});

Type guard

boolean isDayTimeInterval(LogicalType t) { return t instanceof DayTimeIntervalType; }

Try / catch

try {
  RowType rowType = FlinkSchemaUtil.toType(rowDataType);
} catch (UnsupportedOperationException e) {
  // find day-time interval columns and recast to BIGINT millis
}

Prevention

When it happens

Trigger: Flink-to-Iceberg conversion on a schema containing INTERVAL DAY, INTERVAL DAY TO SECOND, INTERVAL HOUR, etc. (DayTimeIntervalType).

Common situations: Persisting results of timestamp subtraction typed as day-time intervals into Iceberg sinks; DDL ported from engines supporting interval storage types.

Related errors


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

Appendix: source

Thrown at flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/FlinkTypeVisitor.java:48

import org.apache.flink.table.types.logical.ZonedTimestampType;

public abstract class FlinkTypeVisitor<T> implements LogicalTypeVisitor<T> {

  // ------------------------- Unsupported types ------------------------------

  @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

View on GitHub (pinned to 86d9c8fc54)