apache/iceberg · error · java.lang.UnsupportedOperationException
Unsupported timestamp type:
Error message
Unsupported timestamp type:
What it means
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.
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.
Example fix
// before Types.TimestampType.withZone() -> Parquet TIMESTAMP_MILLIS // after use TIMESTAMP_MICROS annotation (TimestampLogicalTypeAnnotation(true, MICROS))
Defensive patterns
Strategy: validation
Validate before calling
// java
if (annotation instanceof TimestampLogicalTypeAnnotation) {
TimestampLogicalTypeAnnotation ts = (TimestampLogicalTypeAnnotation) annotation;
if (ts.getUnit() != TimeUnit.MICROS && ts.getUnit() != TimeUnit.NANOS) {
throw new IllegalArgumentException("Timestamp unit must be MICROS or NANOS, got " + ts.getUnit());
}
} Try / catch
// java
try {
writer = FlinkParquetWriters.createWriter(...);
} catch (UnsupportedOperationException e) {
// convert column annotation to MICROS/NANOS and retry
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Unsupported base type for decimal:
- Unsupported logical type:
- Unsupported logical type
- Unsupported timestamp type:
- Unsupported timestamp type
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/ee2389c613950af7.
Report an issue: GitHub.
Appendix: source
Thrown at flink/v2.3/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)