{"record":{"id":"f3c254997c2e644c","repo":"prestodb/presto","slug":"type-must-be-a-timestamptype-for-timestampmillitzv","errorCode":null,"errorMessage":"Type must be a TimestampType for TimeStampMilliTZVector","messagePattern":"Type must be a TimestampType for TimeStampMilliTZVector","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-common-arrow/src/main/java/com/facebook/plugin/arrow/ArrowBlockBuilder.java","lineNumber":642,"sourceCode":"    public void assignTimeTypeBlockFromVarcharVector(VarCharVector vector, Type type, BlockBuilder builder, int startIndex, int endIndex)\n    {\n        for (int i = startIndex; i < endIndex; i++) {\n            if (vector.isNull(i)) {\n                builder.appendNull();\n            }\n            else {\n                String timeString = new String(vector.get(i), StandardCharsets.UTF_8);\n                LocalTime time = LocalTime.parse(timeString);\n                long millis = Duration.between(LocalTime.MIN, time).toMillis();\n                type.writeLong(builder, millis);\n            }\n        }\n    }\n\n    public void assignBlockFromTimeMilliTZVector(TimeStampMilliTZVector vector, Type type, BlockBuilder builder, int startIndex, int endIndex)\n    {\n        if (!(type instanceof TimestampType)) {\n            throw new IllegalArgumentException(\"Type must be a TimestampType for TimeStampMilliTZVector\");\n        }\n\n        for (int i = startIndex; i < endIndex; i++) {\n            if (vector.isNull(i)) {\n                builder.appendNull();\n            }\n            else {\n                long millis = vector.get(i);\n                type.writeLong(builder, millis);\n            }\n        }\n    }\n\n    public void assignBlockFromListVector(ListVector vector, Type type, BlockBuilder builder, int startIndex, int endIndex)\n    {\n        if (!(type instanceof ArrayType)) {\n            throw new IllegalArgumentException(\"Type must be an ArrayType for ListVector\");\n        }","sourceCodeStart":624,"sourceCodeEnd":660,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-common-arrow/src/main/java/com/facebook/plugin/arrow/ArrowBlockBuilder.java#L624-L660","documentation":"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.","triggerScenarios":"Calling assignBlockFromTimeMilliTZVector (directly or via assignBlockFromValueVector) with a non-TimestampType, e.g. TIMESTAMPTZ declared as VARCHAR, or a plain TimeType, or BIGINT.","commonSituations":"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.","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"],"exampleFix":"// before\nassignBlockFromTimeMilliTZVector(tzVector, VarcharType.VARCHAR, builder, start, end);\n// after\nassignBlockFromTimeMilliTZVector(tzVector, TimestampWithTimeZoneType.TIMESTAMP_TZ_MILLIS, builder, start, end);","handlingStrategy":"type-guard","validationCode":"if (!(columnType instanceof TimestampType)) {\n    throw new IllegalStateException(\"Column '\" + name + \"' must be TimestampType to receive TimeStampMilliTZVector, got \" + columnType);\n}","typeGuard":"boolean isTimestampTzColumn(Type type) {\n    return type instanceof TimestampType;\n}","tryCatchPattern":"try {\n    builder.assignBlockFromTimeMilliTZVector(vector, type, blockBuilder, start, end);\n} catch (IllegalArgumentException e) {\n    if (!e.getMessage().contains(\"TimestampType for TimeStampMilliTZVector\")) throw e;\n    // re-map or skip\n}","preventionTips":["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"],"tags":["arrow","type-mismatch","timestamp","timezone"],"backgroundTag":"arrow-vector-type-mismatch","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}