{"record":{"id":"f8cf6c074ceef7c3","repo":"apache/iceberg","slug":"unsupported-zonedtimestamptype-f8cf6c","errorCode":null,"errorMessage":"Unsupported ZonedTimestampType.","messagePattern":"Unsupported ZonedTimestampType\\.","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":38,"sourceCode":"\nimport org.apache.flink.table.types.logical.DayTimeIntervalType;\nimport org.apache.flink.table.types.logical.DistinctType;\nimport org.apache.flink.table.types.logical.LogicalType;\nimport org.apache.flink.table.types.logical.LogicalTypeVisitor;\nimport org.apache.flink.table.types.logical.NullType;\nimport org.apache.flink.table.types.logical.RawType;\nimport org.apache.flink.table.types.logical.StructuredType;\nimport org.apache.flink.table.types.logical.SymbolType;\nimport org.apache.flink.table.types.logical.YearMonthIntervalType;\nimport 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","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/FlinkTypeVisitor.java#L20-L56","documentation":"FlinkTypeVisitor is the abstract visitor mapping Flink logical types to Iceberg types; it provides a default visit(ZonedTimestampType) that throws UnsupportedOperationException because TIMESTAMP WITH LOCAL TIME ZONE has no direct Iceberg mapping in this conversion path. Subclasses may override, but by default encountering this type aborts the conversion.","triggerScenarios":"Any Flink-to-Iceberg type conversion (e.g. FlinkSchemaUtil.toType / fromFlinkSchema) traversing a field of type TIMESTAMP(3) WITH LOCAL TIME ZONE (ZonedTimestampType) using the default visitor behavior.","commonSituations":"Tables with columns sourced from CDC/other connectors using TIMESTAMP_LTZ; writing such a schema into Iceberg without first casting to TIMESTAMP.","solutions":["Cast the column to TIMESTAMP (without local time zone) before writing to Iceberg.","Override visit(ZonedTimestampType) in a custom visitor if a specific mapping is needed.","Express the value as TIMESTAMP and store the timezone semantics out-of-band."],"exampleFix":"// before\nCREATE TABLE t (ts TIMESTAMP(3) WITH LOCAL TIME ZONE) -- iceberg sink\n// after\nCREATE TABLE t (ts TIMESTAMP(3)) -- cast: CAST(ts AS TIMESTAMP(3))","handlingStrategy":"validation","validationCode":"schema.getColumns().forEach(c -> {\n  if (c.getDataType().getLogicalType() instanceof ZonedTimestampType) {\n    throw new IllegalArgumentException(\"Cast TIMESTAMP WITH LOCAL TIME ZONE before Iceberg write: \" + c.getName());\n  }\n});","typeGuard":"boolean isZonedTimestamp(LogicalType t) { return t instanceof ZonedTimestampType; }","tryCatchPattern":"try {\n  RowType rowType = FlinkSchemaUtil.toType(rowDataType);\n} catch (UnsupportedOperationException e) {\n  // inspect schema for TIMESTAMP_LTZ columns and cast them\n}","preventionTips":["Avoid TIMESTAMP WITH LOCAL TIME ZONE columns in tables written to Iceberg.","Cast to TIMESTAMP(6) at the source query boundary.","Check connector-inferred schemas for TIMESTAMP_LTZ before registering Iceberg sinks."],"tags":["flink","type-conversion","unsupported-type","timestamp"],"backgroundTag":"unsupported-dtype","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}