{"record":{"id":"a7fc0a34078e9b18","repo":"apache/iceberg","slug":"unsupported-daytimeintervaltype-a7fc0a","errorCode":null,"errorMessage":"Unsupported DayTimeIntervalType.","messagePattern":"Unsupported DayTimeIntervalType\\.","errorType":"exception","errorClass":"java.lang.UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink/v2.1/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/v2.1/flink/src/main/java/org/apache/iceberg/flink/FlinkTypeVisitor.java#L30-L66","documentation":"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.","triggerScenarios":"Flink-to-Iceberg conversion on a schema containing INTERVAL DAY, INTERVAL DAY TO SECOND, INTERVAL HOUR, etc. (DayTimeIntervalType).","commonSituations":"Persisting results of timestamp subtraction typed as day-time intervals into Iceberg sinks; DDL ported from engines supporting interval storage types.","solutions":["Cast the interval to BIGINT (e.g. milliseconds) or STRING before writing to Iceberg.","Derive the interval on the fly from two TIMESTAMP columns at read time.","Override visit(DayTimeIntervalType) in a custom visitor with an explicit mapping."],"exampleFix":"// before\nCREATE TABLE t (lag INTERVAL DAY TO SECOND) -- iceberg sink\n// after\nCREATE TABLE t (lag_ms BIGINT) -- TIMESTAMPDIFF/epoch millis","handlingStrategy":"validation","validationCode":"schema.getColumns().forEach(c -> {\n  if (c.getDataType().getLogicalType() instanceof DayTimeIntervalType) {\n    throw new IllegalArgumentException(\"Interval DAY/SECOND not supported by Iceberg: \" + c.getName());\n  }\n});","typeGuard":"boolean isDayTimeInterval(LogicalType t) { return t instanceof DayTimeIntervalType; }","tryCatchPattern":"try {\n  RowType rowType = FlinkSchemaUtil.toType(rowDataType);\n} catch (UnsupportedOperationException e) {\n  // find day-time interval columns and recast to BIGINT millis\n}","preventionTips":["Convert day-time intervals to BIGINT (e.g. milliseconds) before writing.","Derive intervals on read from stored TIMESTAMP columns.","Screen connector-produced schemas for interval types before sink registration."],"tags":["flink","type-conversion","unsupported-type","interval"],"backgroundTag":"unsupported-dtype","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}