apache/iceberg · error · java.lang.UnsupportedOperationException
Unsupported timestamp type: ${timestamps}
Error message
Unsupported timestamp type: ${timestamps} What it means
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.
Source
Thrown at flink/v2.1/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)
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
Example fix
// before // TimestampLogicalTypeAnnotation(MILLIS) // after: write files with MICROS // TimestampLogicalTypeAnnotation(MICROS)
Defensive patterns
Strategy: validation
Validate before calling
LogicalTypeAnnotation ann = desc.getPrimitiveType().getLogicalTypeAnnotation();
if (ann instanceof TimestampLogicalTypeAnnotation ts && ts.getUnit() != TimeUnit.MICROS && ts.getUnit() != TimeUnit.NANOS) {
throw new IllegalArgumentException("Unsupported timestamp unit: " + ts.getUnit());
} Try / catch
try { ... } catch (UnsupportedOperationException e) { if (e.getMessage().contains("Unsupported timestamp type")) { /* convert file or map column to long */ } else throw e; } Prevention
- 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
When it happens
Trigger: 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.
Common situations: Files produced by legacy writers that used millis timestamps; hand-built Parquet schemas; converting files between ecosystems.
Related errors
- Unsupported timestamp type: ${timestamps}
- Unsupported logical type: ${primitive.getOriginalType()}
- Unsupported type: ${primitive}
- Unsupported base type for decimal: ${primitiveTypeName}
- Unsupported ZonedTimestampType.
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/e333ceae3bf2036e.
Report an issue: GitHub.