{"record":{"id":"1f3efd026ec2f6e4","repo":"apache/iceberg","slug":"unsupported-timestamp-type-timestamps","errorCode":null,"errorMessage":"Unsupported timestamp type: ${timestamps}","messagePattern":"Unsupported timestamp type: (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/data/FlinkParquetWriters.java","lineNumber":263,"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":245,"sourceCodeEnd":281,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/data/FlinkParquetWriters.java#L245-L281","documentation":"LogicalTypeWriterBuilder.visit(TimestampLogicalTypeAnnotation) supports NANOS and MICROS units; any other timestamp unit falls to the default and throws UnsupportedOperationException. Parquet timestamps are only expected in micro or nano precision.","triggerScenarios":"A Parquet column with a timestamp logical type annotation whose TimeUnit is neither MICROS nor NANOS (e.g. MILLIS from a non-standard producer or a newer parquet library unit).","commonSituations":"Parquet files written by older or non-conforming libraries that used millisecond timestamp annotations; version skew between parquet-column and parquet-avro jars introducing new TimeUnit values; hand-built schemas.","solutions":["Rewrite the data with timestamp columns in MICROS or NANOS units (standard for Iceberg).","Upgrade the parquet-column/parquet-hadoop dependencies to versions that only produce MICROS/NANOS annotations.","Drop the timestamp annotation or cast the column to a plain int64 if sub-second semantics are not needed.","Inspect the file schema with parquet-tools to confirm the actual TimeUnit before patching Iceberg."],"exampleFix":"// before: column annotated as TIMESTAMP(MILLIS)\n// after: rewrite with standard precision\n// Schema: required int64 ts (TIMESTAMP(MICROS,true))","handlingStrategy":"validation","validationCode":"if (ann instanceof TimestampLogicalTypeAnnotation ts &&\n    ts.getUnit() != TimeUnit.MICROS && ts.getUnit() != TimeUnit.NANOS) {\n  throw new IllegalArgumentException(\"unsupported ts unit: \" + ts.getUnit());\n}","typeGuard":null,"tryCatchPattern":"try {\n  writer = ...build();\n} catch (UnsupportedOperationException e) {\n  if (e.getMessage().startsWith(\"Unsupported timestamp type:\")) {\n    // convert column to micros/nanos and retry\n  }\n}","preventionTips":["Write timestamps in MICROS or NANOS units only","Align parquet-column versions across the job classpath","Check file schemas with parquet-tools before reading"],"tags":["flink","parquet","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"}