{"record":{"id":"8115d3e86aa02c8d","repo":"prestodb/presto","slug":"unsupported-vector-type-vector-getclass","errorCode":null,"errorMessage":"Unsupported vector type: {vector.getClass()}","messagePattern":"Unsupported vector type: (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"presto-common-arrow/src/main/java/com/facebook/plugin/arrow/ArrowBlockBuilder.java","lineNumber":318,"sourceCode":"        }\n        else if (vector instanceof TimeStampMilliTZVector) {\n            assignBlockFromTimeMilliTZVector((TimeStampMilliTZVector) vector, type, builder, startIndex, endIndex);\n        }\n        else if (vector instanceof MapVector) {\n            // NOTE: MapVector is also instanceof ListVector, so check for Map first\n            assignBlockFromMapVector((MapVector) vector, type, builder, startIndex, endIndex);\n        }\n        else if (vector instanceof FixedSizeListVector) {\n            assignBlockFromFixedSizeListVector((FixedSizeListVector) vector, type, builder, startIndex, endIndex);\n        }\n        else if (vector instanceof ListVector) {\n            assignBlockFromListVector((ListVector) vector, type, builder, startIndex, endIndex);\n        }\n        else if (vector instanceof StructVector) {\n            assignBlockFromStructVector((StructVector) vector, type, builder, startIndex, endIndex);\n        }\n        else {\n            throw new UnsupportedOperationException(\"Unsupported vector type: \" + vector.getClass());\n        }\n    }\n\n    public void assignBlockFromBitVector(BitVector 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                type.writeBoolean(builder, vector.get(i) == 1);\n            }\n        }\n    }\n\n    public void assignBlockFromIntVector(IntVector vector, Type type, BlockBuilder builder, int startIndex, int endIndex)\n    {\n        for (int i = startIndex; i < endIndex; i++) {","sourceCodeStart":300,"sourceCodeEnd":336,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-common-arrow/src/main/java/com/facebook/plugin/arrow/ArrowBlockBuilder.java#L300-L336","documentation":"assignBlockFromValueVector dispatches a ValueVector to a type-specific assignBlockFrom* method; if the vector matches none of the supported instanceof branches (Bit, TinyInt, Int, BigInt, Float, Decimal, Timestamp, VarChar, Date, Time, List, Struct, Map, FixedSizeList), it throws UnsupportedOperationException naming the vector's class. It is the generic fallback for Arrow vectors the builder cannot write into a Presto BlockBuilder.","triggerScenarios":"buildBlockFromFieldVector or any nested assignBlockFromListVector/FixedSizeListVector/MapVector/StructVector call encounters an element ValueVector of an unmapped Arrow type (e.g. TimeMicroVector, DurationVector, IntervalYearVector, LargeVarCharVector).","commonSituations":"Nested Arrow columns (lists/structs/maps) containing element types the connector does not map; schema evolution upstream introduces a new primitive; Arrow version upgrade changes vector classes (e.g. large-offset variants).","solutions":["Inspect the reported vector class and verify it against the instanceof chain in assignBlockFromValueVector","Remap the column to a supported Arrow type at the producer, or drop the column from the query/schema","Add an instanceof branch and a corresponding assignBlockFrom* writer for the vector type","Upgrade to a connector version supporting that Arrow type"],"exampleFix":"// before\nthrow new UnsupportedOperationException(\"Unsupported vector type: \" + vector.getClass());\n// after: add a branch before the throw\nif (vector instanceof LargeVarCharVector) {\n    assignBlockFromVarCharVector(toVarChar(vector), type, builder, startIndex, endIndex);\n    return;\n}","handlingStrategy":"type-guard","validationCode":"// recursively validate the Arrow schema, including nested children\nvalidateVectorTypes(fieldVector);\n\nvoid validateVectorTypes(FieldVector v) {\n    if (!isSupportedArrowVector(v)) {\n        throw new IllegalStateException(\"Unsupported Arrow vector: \" + v.getClass().getName());\n    }\n    for (FieldVector child : v.getChildrenFromFields()) {\n        validateVectorTypes(child);\n    }\n}","typeGuard":"boolean isSupportedElementVector(ValueVector v) {\n    return v instanceof BitVector || v instanceof IntVector || v instanceof BigIntVector\n        || v instanceof Float4Vector || v instanceof Float8Vector || v instanceof DecimalVector\n        || v instanceof VarCharVector || v instanceof DateDayVector || v instanceof DateMilliVector\n        || v instanceof TimeSecVector || v instanceof TimeMilliVector\n        || v instanceof TimeStampMicroVector || v instanceof TimeStampMilliVector;\n}","tryCatchPattern":"try {\n    blockBuilder.assignBlockFromValueVector(vector, type, builder, 0, rowCount);\n} catch (UnsupportedOperationException e) {\n    if (e.getMessage().startsWith(\"Unsupported vector type\")) {\n        LOG.warn(\"Falling back to JSON serialization for %s\", vector.getClass().getName());\n        assignAsJsonString(vector, type, builder, 0, rowCount);\n        return;\n    }\n    throw e;\n}","preventionTips":["Validate nested children of list/struct/map vectors, not just top-level columns","Check the Arrow schema after any upstream schema evolution","Upgrade the connector when adopting new Arrow vector variants (large-offset, duration, interval)","Log and alert on the reported class so unsupported types are caught in CI"],"tags":["arrow","java","unsupported-type","unsupported-operation"],"backgroundTag":"unsupported-arrow-vector-type","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"}