{"record":{"id":"de07772529f3abce","repo":"apache/seatunnel","slug":"list-type-should-be-handled-via-fragmentconverter","errorCode":null,"errorMessage":"List type should be handled via FragmentConverter.writeListToVector","messagePattern":"List type should be handled via FragmentConverter\\.writeListToVector","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-lance/src/main/java/org/apache/seatunnel/connectors/seatunnel/lance/sink/writers/ListTypeWriter.java","lineNumber":35,"sourceCode":"\npackage org.apache.seatunnel.connectors.seatunnel.lance.sink.writers;\n\nimport org.apache.arrow.memory.BufferAllocator;\nimport org.apache.arrow.vector.FieldVector;\nimport org.apache.arrow.vector.complex.impl.UnionListWriter;\nimport org.apache.arrow.vector.complex.impl.UnionMapWriter;\nimport org.apache.arrow.vector.types.pojo.ArrowType;\n\n/** Writer for List type - placeholder, actual implementation handled separately. */\npublic class ListTypeWriter extends BaseTypeWriter {\n    @Override\n    public void writeToVector(\n            FieldVector vector,\n            ArrowType arrowType,\n            Object value,\n            int rowIndex,\n            BufferAllocator allocator) {\n        throw new UnsupportedOperationException(\n                \"List type should be handled via FragmentConverter.writeListToVector\");\n    }\n\n    @Override\n    public void writeToListWriter(\n            UnionListWriter writer, ArrowType arrowType, Object value, BufferAllocator allocator) {\n        throw new UnsupportedOperationException(\"Nested list writing not yet implemented\");\n    }\n\n    @Override\n    public void writeToMapKey(\n            UnionMapWriter writer, ArrowType arrowType, Object value, BufferAllocator allocator) {\n        throw new UnsupportedOperationException(\"List as map key is not supported\");\n    }\n\n    @Override\n    public void writeToMapValue(\n            UnionMapWriter writer, ArrowType arrowType, Object value, BufferAllocator allocator) {","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-lance/src/main/java/org/apache/seatunnel/connectors/seatunnel/lance/sink/writers/ListTypeWriter.java#L17-L53","documentation":"ListTypeWriter.writeToVector is intentionally a stub: list-typed values are written by FragmentConverter.writeListToVector, which creates list vectors directly, not through the per-field writer's writeToVector. Calling it always throws UnsupportedOperationException. It indicates a routing bug: list data was dispatched to the generic vector writer instead of the fragment converter.","triggerScenarios":"Calling ListTypeWriter.writeToVector directly (or a generic dispatch that passes an ArrowType.List field vector into it) instead of using FragmentConverter.writeListToVector for list columns.","commonSituations":"Custom code iterating row fields and calling the generic writer per field without special-casing list types; a code path bypassing FragmentConverter.reconvert.","solutions":["Route list-typed fields through FragmentConverter.writeListToVector instead of the writer's writeToVector.","If hit inside the connector during flushBatch, it is an internal routing bug — report it / upgrade the connector version.","In custom code, check field.getType() instanceof ArrowType.List before choosing a writer path."],"exampleFix":"// before\nwriter.writeToVector(listVector, arrowType, value, rowIndex, allocator);\n// after\nFragmentConverter.writeListToVector(listVector, arrowType, value, rowIndex, allocator);","handlingStrategy":"type-guard","validationCode":"if (field.getType() instanceof ArrowType.List) { // must use FragmentConverter path, not writeToVector }","typeGuard":"static boolean isListField(org.apache.arrow.vector.types.pojo.Field f) { return f.getType() instanceof ArrowType.List; }","tryCatchPattern":"try { writer.writeToVector(vec, arrowType, value, idx, allocator); } catch (UnsupportedOperationException e) { if (e.getMessage().contains(\"FragmentConverter.writeListToVector\")) { FragmentConverter.writeListToVector(vec, arrowType, value, idx, allocator); return; } throw e; }","preventionTips":["Never call writeToVector for ArrowType.List fields; dispatch to FragmentConverter.writeListToVector.","Centralize field-dispatch logic in one place that special-cases lists.","Keep to the standard FragmentConverter.reconvert pipeline instead of ad-hoc writers."],"tags":["lance","arrow","list","unsupported"],"backgroundTag":"method-not-implemented","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}