apache/iceberg · error · UnsupportedOperationException

Unsupported timestamp type:

Error message

Unsupported timestamp type: 

What it means

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.

Solutions

  1. Rewrite timestamps as micros (Iceberg default) before writing through this writer
  2. Convert the column to a plain supported timestamp type
  3. Upgrade Iceberg if broader unit support is needed

Example fix

// before: TimestampLogicalTypeAnnotation(MILLIS, isAdjustedToUTC)
// after: rewrite to TimestampLogicalTypeAnnotation(MICROS, isAdjustedToUTC)
Defensive patterns

Strategy: validation

Validate before calling

TimestampLogicalTypeAnnotation ts = ...;
Preconditions.checkArgument(
    ts.getUnit() == TimeUnit.MICROS || ts.getUnit() == TimeUnit.NANOS,
    "Timestamp unit must be MICROS or NANOS, found: " + ts.getUnit());

Try / catch

try {
  writer = timestampVisitor.visit(tsAnnotation);
} catch (UnsupportedOperationException e) {
  throw new WriteException("Unsupported timestamp unit: " + e.getMessage(), e);
}

Prevention

When it happens

Trigger: Writing timestamp columns whose Parquet TimestampLogicalTypeAnnotation unit is not NANOS or MICROS, e.g. MILLIS from legacy producers.

Common situations: Writing files copied or reshaped from legacy Hive/Impala writers that used millis, or schema conversions that preserved the original annotation unit.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/2f473cc9e1122c00. Report an issue: GitHub.

Appendix: source

Thrown at flink/v2.2/flink/src/main/java/org/apache/iceberg/flink/data/FlinkParquetWriters.java:285

      Preconditions.checkArgument(
          LogicalTypeAnnotation.TimeUnit.MICROS.equals(times.getUnit()),
          "Cannot write time in %s, only MICROS is supported",
          times.getUnit());
      return Optional.of(timeMicros(desc));
    }

    @Override
    public Optional<ParquetValueWriter<?>> visit(TimestampLogicalTypeAnnotation timestamps) {
      ParquetValueWriter<TimestampData> writer;
      switch (timestamps.getUnit()) {
        case NANOS:
          writer = timestampNanos(desc);
          break;
        case MICROS:
          writer = timestamps(desc);
          break;
        default:
          throw new UnsupportedOperationException("Unsupported timestamp type: " + timestamps);
      }

      return Optional.of(writer);
    }

    @Override
    public Optional<ParquetValueWriter<?>> visit(IntLogicalTypeAnnotation type) {
      Preconditions.checkArgument(type.isSigned(), "Cannot write unsigned integer type: %s", type);
      ParquetValueWriter<?> writer;
      if (type.getBitWidth() < 64) {
        writer = ints(flinkType, desc);
      } else {
        writer = ParquetValueWriters.longs(desc);
      }

      return Optional.of(writer);
    }

View on GitHub (pinned to 86d9c8fc54)