{"record":{"id":"ceaae65cb93ae99b","repo":"apache/iceberg","slug":"unsupported-daytimeintervaltype","errorCode":null,"errorMessage":"Unsupported DayTimeIntervalType.","messagePattern":"Unsupported DayTimeIntervalType\\.","errorType":"exception","errorClass":"java.lang.UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/FlinkTypeVisitor.java","lineNumber":48,"sourceCode":"import org.apache.flink.table.types.logical.ZonedTimestampType;\n\npublic abstract class FlinkTypeVisitor<T> implements LogicalTypeVisitor<T> {\n\n  // ------------------------- Unsupported types ------------------------------\n\n  @Override\n  public T visit(ZonedTimestampType zonedTimestampType) {\n    throw new UnsupportedOperationException(\"Unsupported ZonedTimestampType.\");\n  }\n\n  @Override\n  public T visit(YearMonthIntervalType yearMonthIntervalType) {\n    throw new UnsupportedOperationException(\"Unsupported YearMonthIntervalType.\");\n  }\n\n  @Override\n  public T visit(DayTimeIntervalType dayTimeIntervalType) {\n    throw new UnsupportedOperationException(\"Unsupported DayTimeIntervalType.\");\n  }\n\n  @Override\n  public T visit(DistinctType distinctType) {\n    throw new UnsupportedOperationException(\"Unsupported DistinctType.\");\n  }\n\n  @Override\n  public T visit(StructuredType structuredType) {\n    throw new UnsupportedOperationException(\"Unsupported StructuredType.\");\n  }\n\n  @Override\n  public T visit(NullType nullType) {\n    throw new UnsupportedOperationException(\"Unsupported NullType.\");\n  }\n\n  @Override","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/FlinkTypeVisitor.java#L30-L66","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Remove the DayTimeIntervalType column from the schema before Iceberg conversion.","Cast the interval to BIGINT (e.g. milliseconds) or STRING in SQL before the Iceberg sink.","Store the two timestamps in Iceberg and compute the day-time interval downstream at query time.","Override visit(DayTimeIntervalType) in a custom FlinkTypeVisitor subclass with a mapping (e.g. to LongType)."],"exampleFix":"// before\nINSERT INTO iceberg_t SELECT a - b AS dur FROM src; // dur is INTERVAL DAY TO SECOND\n// after\nINSERT INTO iceberg_t SELECT CAST(a - b AS BIGINT) AS dur_millis FROM src;","handlingStrategy":"validation","validationCode":"import org.apache.flink.table.types.logical.DayTimeIntervalType;\nimport org.apache.flink.table.types.logical.LogicalType;\n\nstatic void assertNoDayTimeInterval(org.apache.flink.table.api.Schema schema) {\n  schema.getColumns().forEach(c -> {\n    if (c.getType().getLogicalType() instanceof DayTimeIntervalType) {\n      throw new IllegalArgumentException(\n          \"Column \" + c + \" (INTERVAL DAY/SECOND) is not supported by Iceberg; cast to BIGINT or STRING first.\");\n    }\n  });\n}","typeGuard":"static boolean isDayTimeInterval(LogicalType t) {\n  return t instanceof DayTimeIntervalType;\n}","tryCatchPattern":null,"preventionTips":["Avoid interval-returning expressions in INSERT INTO ... SELECT for Iceberg sinks; wrap them in CAST(... AS BIGINT).","Store start/end timestamps in Iceberg and compute durations at query time.","Review UDF return types for Flink interval types.","Run schema conversion in a validation step before deploying the job."],"tags":["flink","iceberg","unsupported-type","type-conversion"],"backgroundTag":"unsupported-operation","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}