prestodb/presto · error · IllegalArgumentException
Type must be a TimestampType for TimeStampMilliTZVector
Error message
Type must be a TimestampType for TimeStampMilliTZVector
What it means
assignBlockFromTimeMilliTZVector reads an Arrow TimeStampMilliTZVector (millisecond timestamps with timezone metadata) and writes a Presto block; this mapping is only valid when the Presto Type is TimestampType (with timezone). Any other declared Type makes the conversion undefined, so the method throws this IllegalArgumentException up front.
Source
Thrown at presto-common-arrow/src/main/java/com/facebook/plugin/arrow/ArrowBlockBuilder.java:642
public void assignTimeTypeBlockFromVarcharVector(VarCharVector vector, Type type, BlockBuilder builder, int startIndex, int endIndex)
{
for (int i = startIndex; i < endIndex; i++) {
if (vector.isNull(i)) {
builder.appendNull();
}
else {
String timeString = new String(vector.get(i), StandardCharsets.UTF_8);
LocalTime time = LocalTime.parse(timeString);
long millis = Duration.between(LocalTime.MIN, time).toMillis();
type.writeLong(builder, millis);
}
}
}
public void assignBlockFromTimeMilliTZVector(TimeStampMilliTZVector vector, Type type, BlockBuilder builder, int startIndex, int endIndex)
{
if (!(type instanceof TimestampType)) {
throw new IllegalArgumentException("Type must be a TimestampType for TimeStampMilliTZVector");
}
for (int i = startIndex; i < endIndex; i++) {
if (vector.isNull(i)) {
builder.appendNull();
}
else {
long millis = vector.get(i);
type.writeLong(builder, millis);
}
}
}
public void assignBlockFromListVector(ListVector vector, Type type, BlockBuilder builder, int startIndex, int endIndex)
{
if (!(type instanceof ArrayType)) {
throw new IllegalArgumentException("Type must be an ArrayType for ListVector");
}View on GitHub (pinned to 55bb57d202)
Solutions
- Declare the Presto column as timestamp with time zone (TimestampType) matching the vector
- Update the type passed in the assignBlockFromValueVector dispatch for this vector
- Align the Arrow schema and Presto table schema before the read
Example fix
// before assignBlockFromTimeMilliTZVector(tzVector, VarcharType.VARCHAR, builder, start, end); // after assignBlockFromTimeMilliTZVector(tzVector, TimestampWithTimeZoneType.TIMESTAMP_TZ_MILLIS, builder, start, end);
Defensive patterns
Strategy: type-guard
Validate before calling
if (!(columnType instanceof TimestampType)) {
throw new IllegalStateException("Column '" + name + "' must be TimestampType to receive TimeStampMilliTZVector, got " + columnType);
} Type guard
boolean isTimestampTzColumn(Type type) {
return type instanceof TimestampType;
} Try / catch
try {
builder.assignBlockFromTimeMilliTZVector(vector, type, blockBuilder, start, end);
} catch (IllegalArgumentException e) {
if (!e.getMessage().contains("TimestampType for TimeStampMilliTZVector")) throw e;
// re-map or skip
} Prevention
- Keep producer TZ metadata and Presto timestamp-with-time-zone declarations in sync
- Re-derive column metadata whenever the Arrow schema changes
- Assert schema compatibility at session start, not per-block
When it happens
Trigger: Calling assignBlockFromTimeMilliTZVector (directly or via assignBlockFromValueVector) with a non-TimestampType, e.g. TIMESTAMPTZ declared as VARCHAR, or a plain TimeType, or BIGINT.
Common situations: Arrow producer sends TIMESTAMPMILLI,TZ:UTC vectors but Presto metadata says the column is BIGINT or VARCHAR; schema evolved on the producer side (added TZ) without updating the Presto connector's column types.
Related errors
- Expected TimestampType but got {type.getClass().getName()}
- Type must be a TimestampType for TimeStampSecVector
- Type must be a DecimalType for DecimalVector
- Expected VarcharType but got {type.getClass().getName()}
- Expected DateType but got {type.getClass().getName()}
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/f3c254997c2e644c.
Report an issue: GitHub.