{"record":{"id":"cbeeeb109b1caf36","repo":"prestodb/presto","slug":"type-must-be-a-timestamptype-for-timestampsecvecto","errorCode":null,"errorMessage":"Type must be a TimestampType for TimeStampSecVector","messagePattern":"Type must be a TimestampType for TimeStampSecVector","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-common-arrow/src/main/java/com/facebook/plugin/arrow/ArrowBlockBuilder.java","lineNumber":596,"sourceCode":"        if (!(type instanceof TimeType)) {\n            throw new IllegalArgumentException(\"Type must be a TimeType for TimemicroVector\");\n        }\n        for (int i = startIndex; i < endIndex; i++) {\n            if (vector.isNull(i)) {\n                builder.appendNull();\n            }\n            else {\n                long value = vector.get(i);\n                long micro = TimeUnit.MICROSECONDS.toMillis(value);\n                type.writeLong(builder, micro);\n            }\n        }\n    }\n\n    public void assignBlockFromTimeStampSecVector(TimeStampSecVector 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 TimeStampSecVector\");\n        }\n\n        for (int i = startIndex; i < endIndex; i++) {\n            if (vector.isNull(i)) {\n                builder.appendNull();\n            }\n            else {\n                long value = vector.get(i);\n                long millis = TimeUnit.SECONDS.toMillis(value);\n                type.writeLong(builder, millis);\n            }\n        }\n    }\n\n    public void assignCharTypeBlockFromVarcharVector(VarCharVector vector, Type type, BlockBuilder builder, int startIndex, int endIndex)\n    {\n        for (int i = startIndex; i < endIndex; i++) {\n            if (vector.isNull(i)) {","sourceCodeStart":578,"sourceCodeEnd":614,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-common-arrow/src/main/java/com/facebook/plugin/arrow/ArrowBlockBuilder.java#L578-L614","documentation":"assignBlockFromTimeStampSecVector converts an Arrow TimeStampSecVector (seconds-since-epoch values) into a Presto block, which requires the Presto column Type to be TimestampType. A non-TimestampType cannot express the values correctly, so the method throws this IllegalArgumentException before writing any rows.","triggerScenarios":"Calling assignBlockFromTimeStampSecVector (directly or via assignBlockFromValueVector) with a Type that is not TimestampType, e.g. a BIGINT or DATE column type paired with a TIMESTAMP_SEC vector.","commonSituations":"Arrow source emits epoch-seconds while the Presto column is declared as BIGINT (raw epoch) or DATE; type metadata built from a stale/different schema than the vectors; column order mismatch in a dispatch switch.","solutions":["Declare the Presto column as TimestampType to match the TimeStampSecVector","Correct the type passed through assignBlockFromValueVector's dispatch for this column","Convert the vector to the expected minor type on the producer side (or cast in Presto)"],"exampleFix":"// before\nassignBlockFromTimeStampSecVector(secVector, BigintType.BIGINT, builder, start, end);\n// after\nassignBlockFromTimeStampSecVector(secVector, TimestampType.TIMESTAMP, builder, start, end);","handlingStrategy":"type-guard","validationCode":"if (!(columnType instanceof TimestampType)) {\n    throw new IllegalStateException(\"Column '\" + name + \"' must be TimestampType to receive TimeStampSecVector, got \" + columnType);\n}","typeGuard":"boolean isTimestampColumn(Type type) {\n    return type instanceof TimestampType;\n}","tryCatchPattern":"try {\n    builder.assignBlockFromTimeStampSecVector(vector, type, blockBuilder, start, end);\n} catch (IllegalArgumentException e) {\n    if (!e.getMessage().contains(\"TimestampType for TimeStampSecVector\")) throw e;\n    // correct the type or re-dispatch\n}","preventionTips":["Validate the Arrow schema against the Presto table schema before reading","Generate the dispatch switch from schema metadata, not by hand","Test epoch-seconds columns against their declared Presto types"],"tags":["arrow","type-mismatch","timestamp","presto"],"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"}