apache/iceberg · error · UnsupportedOperationException

Unsupported DayTimeIntervalType.

Error message

Unsupported DayTimeIntervalType.

What it means

FlinkTypeVisitor.visit(DayTimeIntervalType) throws UnsupportedOperationException because Iceberg cannot represent Flink's INTERVAL DAY TO SECOND type. Flink-to-Iceberg type conversion fails fast rather than silently losing precision.

Solutions

  1. Convert the interval to milliseconds/seconds as BIGINT before writing.
  2. Change the DDL column to BIGINT or STRING instead of INTERVAL DAY TO SECOND.
  3. Override visit(DayTimeIntervalType) with a custom mapping in a project-specific visitor.

Example fix

// before
CREATE TABLE t (dur INTERVAL DAY TO SECOND);
// after
CREATE TABLE t (dur_millis BIGINT);
Defensive patterns

Strategy: type-guard

Validate before calling

if (dataType.getLogicalType() instanceof DayTimeIntervalType) {
  throw new IllegalArgumentException("Convert INTERVAL DAY TO SECOND to BIGINT millis before Iceberg write");
}

Prevention

When it happens

Trigger: Converting a Flink schema containing `INTERVAL DAY TO SECOND` columns (e.g. from computed time differences) to Iceberg types.

Common situations: ETL jobs computing durations between timestamps and carrying the INTERVAL result column into an Iceberg sink table.

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

Appendix: source

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