{"record":{"id":"e333ceae3bf2036e","repo":"apache/iceberg","slug":"unsupported-timestamp-type-timestamps-e333ce","errorCode":null,"errorMessage":"Unsupported timestamp type: ${timestamps}","messagePattern":"Unsupported timestamp type: (.+?)","errorType":"exception","errorClass":"java.lang.UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink/v2.1/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.1/flink/src/main/java/org/apache/iceberg/flink/data/FlinkParquetWriters.java#L267-L303","documentation":"When building a writer for an annotated Parquet timestamp column, Iceberg's Flink writer supports only NANOS and MICROS units. Any other TimeUnit annotation (MILLIS, SECONDS) has no corresponding writer, so the library throws UnsupportedOperationException. Parquet spec-recommended encodings are only NANO/MICRO, so this signals a nonstandard file.","triggerScenarios":"Visiting a Parquet type with TimestampLogicalTypeAnnotation whose TimeUnit is neither MICROS nor NANOS (e.g. MILLIS), during Flink write/read planning of a Parquet file.","commonSituations":"Files produced by legacy writers that used millis timestamps; hand-built Parquet schemas; converting files between ecosystems.","solutions":["Rewrite the Parquet file with timestamps in MICROS or NANOS (e.g. via Spark/Iceberg)","Convert the column to long with the original unit and handle the conversion in user code","If you control the source writer, configure it to emit MICROS/NANOS timestamp annotations"],"exampleFix":"// before\n// TimestampLogicalTypeAnnotation(MILLIS)\n// after: write files with MICROS\n// TimestampLogicalTypeAnnotation(MICROS)","handlingStrategy":"validation","validationCode":"LogicalTypeAnnotation ann = desc.getPrimitiveType().getLogicalTypeAnnotation();\nif (ann instanceof TimestampLogicalTypeAnnotation ts && ts.getUnit() != TimeUnit.MICROS && ts.getUnit() != TimeUnit.NANOS) {\n  throw new IllegalArgumentException(\"Unsupported timestamp unit: \" + ts.getUnit());\n}","typeGuard":null,"tryCatchPattern":"try { ... } catch (UnsupportedOperationException e) { if (e.getMessage().contains(\"Unsupported timestamp type\")) { /* convert file or map column to long */ } else throw e; }","preventionTips":["Standardize on MICROS or NANOS timestamp annotations when writing Parquet","Convert millis/seconds timestamps to long columns instead of annotated types","Pre-validate Parquet schemas in ingestion pipelines"],"tags":["parquet","flink","timestamp","unsupported-type"],"backgroundTag":"unsupported-enum-value","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"}