{"record":{"id":"2f473cc9e1122c00","repo":"apache/iceberg","slug":"unsupported-timestamp-type","errorCode":null,"errorMessage":"Unsupported timestamp type: ","messagePattern":"Unsupported timestamp type: ","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink/v2.2/flink/src/main/java/org/apache/iceberg/flink/data/FlinkParquetWriters.java","lineNumber":285,"sourceCode":"      Preconditions.checkArgument(\n          LogicalTypeAnnotation.TimeUnit.MICROS.equals(times.getUnit()),\n          \"Cannot write time in %s, only MICROS is supported\",\n          times.getUnit());\n      return Optional.of(timeMicros(desc));\n    }\n\n    @Override\n    public Optional<ParquetValueWriter<?>> visit(TimestampLogicalTypeAnnotation timestamps) {\n      ParquetValueWriter<TimestampData> writer;\n      switch (timestamps.getUnit()) {\n        case NANOS:\n          writer = timestampNanos(desc);\n          break;\n        case MICROS:\n          writer = timestamps(desc);\n          break;\n        default:\n          throw new UnsupportedOperationException(\"Unsupported timestamp type: \" + timestamps);\n      }\n\n      return Optional.of(writer);\n    }\n\n    @Override\n    public Optional<ParquetValueWriter<?>> visit(IntLogicalTypeAnnotation type) {\n      Preconditions.checkArgument(type.isSigned(), \"Cannot write unsigned integer type: %s\", type);\n      ParquetValueWriter<?> writer;\n      if (type.getBitWidth() < 64) {\n        writer = ints(flinkType, desc);\n      } else {\n        writer = ParquetValueWriters.longs(desc);\n      }\n\n      return Optional.of(writer);\n    }\n","sourceCodeStart":267,"sourceCodeEnd":303,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v2.2/flink/src/main/java/org/apache/iceberg/flink/data/FlinkParquetWriters.java#L267-L303","documentation":"FlinkParquetWriters' timestamp visitor supports only NANOS and MICROS Parquet unit annotations; any other unit (e.g. MILLIS) reaches the default branch and throws UnsupportedOperationException 'Unsupported timestamp type: <unit>'. Iceberg's canonical Parquet timestamps are micros, with nanos supported; other units are not writable through this path.","triggerScenarios":"Writing timestamp columns whose Parquet TimestampLogicalTypeAnnotation unit is not NANOS or MICROS, e.g. MILLIS from legacy producers.","commonSituations":"Writing files copied or reshaped from legacy Hive/Impala writers that used millis, or schema conversions that preserved the original annotation unit.","solutions":["Rewrite timestamps as micros (Iceberg default) before writing through this writer","Convert the column to a plain supported timestamp type","Upgrade Iceberg if broader unit support is needed"],"exampleFix":"// before: TimestampLogicalTypeAnnotation(MILLIS, isAdjustedToUTC)\n// after: rewrite to TimestampLogicalTypeAnnotation(MICROS, isAdjustedToUTC)","handlingStrategy":"validation","validationCode":"TimestampLogicalTypeAnnotation ts = ...;\nPreconditions.checkArgument(\n    ts.getUnit() == TimeUnit.MICROS || ts.getUnit() == TimeUnit.NANOS,\n    \"Timestamp unit must be MICROS or NANOS, found: \" + ts.getUnit());","typeGuard":null,"tryCatchPattern":"try {\n  writer = timestampVisitor.visit(tsAnnotation);\n} catch (UnsupportedOperationException e) {\n  throw new WriteException(\"Unsupported timestamp unit: \" + e.getMessage(), e);\n}","preventionTips":["Normalize timestamps to micros when converting legacy data","Avoid copying Parquet files between engines without rewriting annotations","Use Iceberg's writer so annotations are canonical"],"tags":["flink","parquet","timestamp"],"backgroundTag":"unsupported-operation","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"}