{"record":{"id":"ee2389c613950af7","repo":"apache/iceberg","slug":"unsupported-timestamp-type-ee2389","errorCode":null,"errorMessage":"Unsupported timestamp type: ","messagePattern":"Unsupported timestamp type: ","errorType":"exception","errorClass":"java.lang.UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink/v2.3/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.3/flink/src/main/java/org/apache/iceberg/flink/data/FlinkParquetWriters.java#L267-L303","documentation":"LogicalTypeWriterBuilder.visit(TimestampLogicalTypeAnnotation) supports writing timestamps as NANOS or MICROS units. Any other TimestampUnit (e.g. MILLIS, or future units) falls to the default branch and throws UnsupportedOperationException naming the timestamp annotation.","triggerScenarios":"Creating a Flink Parquet writer for a column annotated with TimestampLogicalTypeAnnotation using a unit other than MICROS or NANOS — most commonly isAdjustedToUTC/NANOS variants aside, a MILLIS-annotated timestamp column.","commonSituations":"Schemas copied from engines that emit MILLIS timestamp annotations (e.g. some Spark/Hive writers); hand-built Parquet schemas with TIMESTAMP_MILLIS; format conversion that preserved the source unit.","solutions":["Change the column annotation to TIMESTAMP(MICROS) or TIMESTAMP(NANOS) in the write schema.","Convert the data at the source (e.g. scale millis to micros) and re-write with a supported unit.","Add a MILLIS case (writing via the existing micros/nanos writer after conversion) in visit(...) if support is needed."],"exampleFix":"// before\nTypes.TimestampType.withZone() -> Parquet TIMESTAMP_MILLIS\n// after\nuse TIMESTAMP_MICROS annotation (TimestampLogicalTypeAnnotation(true, MICROS))","handlingStrategy":"validation","validationCode":"// java\nif (annotation instanceof TimestampLogicalTypeAnnotation) {\n  TimestampLogicalTypeAnnotation ts = (TimestampLogicalTypeAnnotation) annotation;\n  if (ts.getUnit() != TimeUnit.MICROS && ts.getUnit() != TimeUnit.NANOS) {\n    throw new IllegalArgumentException(\"Timestamp unit must be MICROS or NANOS, got \" + ts.getUnit());\n  }\n}","typeGuard":null,"tryCatchPattern":"// java\ntry {\n  writer = FlinkParquetWriters.createWriter(...);\n} catch (UnsupportedOperationException e) {\n  // convert column annotation to MICROS/NANOS and retry\n}","preventionTips":["Standardize on TIMESTAMP(MICROS) for all Parquet timestamp columns.","Convert MILLIS-annotated inputs to micros during ingestion.","Test write paths against schemas from every producing engine you support."],"tags":["flink","parquet","timestamp","writer"],"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-23T08:17:48.524Z"}