apache/iceberg · error · java.lang.UnsupportedOperationException

Unsupported DayTimeIntervalType.

Error message

Unsupported DayTimeIntervalType.

What it means

Flink's DayTimeIntervalType (INTERVAL DAY/SECOND) has no corresponding Iceberg type, so FlinkTypeVisitor throws UnsupportedOperationException when conversion reaches it. Iceberg's schema model has no day-time interval type, so conversion fails fast rather than silently dropping data.

Source

Thrown at flink/v1.20/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)

Solutions

  1. Remove the DayTimeIntervalType column from the schema before Iceberg conversion.
  2. Cast the interval to BIGINT (e.g. milliseconds) or STRING in SQL before the Iceberg sink.
  3. Store the two timestamps in Iceberg and compute the day-time interval downstream at query time.
  4. Override visit(DayTimeIntervalType) in a custom FlinkTypeVisitor subclass with a mapping (e.g. to LongType).

Example fix

// before
INSERT INTO iceberg_t SELECT a - b AS dur FROM src; // dur is INTERVAL DAY TO SECOND
// after
INSERT INTO iceberg_t SELECT CAST(a - b AS BIGINT) AS dur_millis FROM src;
Defensive patterns

Strategy: validation

Validate before calling

import org.apache.flink.table.types.logical.DayTimeIntervalType;
import org.apache.flink.table.types.logical.LogicalType;

static void assertNoDayTimeInterval(org.apache.flink.table.api.Schema schema) {
  schema.getColumns().forEach(c -> {
    if (c.getType().getLogicalType() instanceof DayTimeIntervalType) {
      throw new IllegalArgumentException(
          "Column " + c + " (INTERVAL DAY/SECOND) is not supported by Iceberg; cast to BIGINT or STRING first.");
    }
  });
}

Type guard

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

Prevention

When it happens

Trigger: Running a FlinkTypeVisitor-based conversion on a row type containing INTERVAL DAY, INTERVAL DAY TO HOUR/MINUTE/SECOND, INTERVAL HOUR TO SECOND, etc., e.g. during Iceberg sink schema resolution or FlinkCatalog table operations.

Common situations: Using Flink SQL expressions that return day-time intervals and materializing them into an Iceberg sink; defining a view with an interval column feeding an Iceberg table; copying schemas from engines that support intervals.

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/ceaae65cb93ae99b. Report an issue: GitHub.