{"record":{"id":"ae1db293e05e6ddd","repo":"apache/seatunnel","slug":"map-in-list-writing-not-yet-implemented","errorCode":null,"errorMessage":"Map in list writing not yet implemented","messagePattern":"Map in list writing not yet implemented","errorType":"exception","errorClass":"java.lang.UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-lance/src/main/java/org/apache/seatunnel/connectors/seatunnel/lance/sink/writers/MapTypeWriter.java","lineNumber":41,"sourceCode":"import org.apache.arrow.vector.complex.impl.UnionMapWriter;\nimport org.apache.arrow.vector.types.pojo.ArrowType;\n\npublic class MapTypeWriter 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                \"Map type should be handled via FragmentConverter.writeMapToVector\");\n    }\n\n    @Override\n    public void writeToListWriter(\n            UnionListWriter writer, ArrowType arrowType, Object value, BufferAllocator allocator) {\n        throw new UnsupportedOperationException(\"Map in 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(\"Map as map key is not supported\");\n    }\n\n    @Override\n    public void writeToMapValue(\n            UnionMapWriter writer, ArrowType arrowType, Object value, BufferAllocator allocator) {\n        throw new UnsupportedOperationException(\"Map as map value not yet implemented\");\n    }\n}\n","sourceCodeStart":23,"sourceCodeEnd":56,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-lance/src/main/java/org/apache/seatunnel/connectors/seatunnel/lance/sink/writers/MapTypeWriter.java#L23-L56","documentation":"MapTypeWriter.writeToListWriter rejects MAP elements nested inside a LIST column. Writing map-typed elements of an Arrow list vector is not implemented in the Lance connector; the generic list writer dispatch reaches this method and throws UnsupportedOperationException.","triggerScenarios":"A SeaTunnel LIST column whose element type is MAP (e.g. array<map<string,string>>); when FragmentConverter.writeListElement dispatches on the element's ArrowType.Map it lands in MapTypeWriter.writeToListWriter, which always throws.","commonSituations":"Nested JSON arrays of objects being ingested into Lance; schemas ported from engines (Flink/Spark) that allow array<map<...>>; users assuming full nested-type parity in the Lance sink.","solutions":["Flatten to a list of structs instead: array<struct<...>> which Lance/Arrow supports via the struct element writer.","Serialize each map element to a JSON string so the list element type is a scalar string.","Reshape data so maps live at the top level (handled by FragmentConverter.writeMapToVector) rather than inside lists.","Implement writeToListWriter for maps in a fork if nested support is required."],"exampleFix":"// before\ncolumns = \"items array<map<string, string>>\"\n\n// after: list of structs\ncolumns = \"items array<struct<k string, v string>>\"","handlingStrategy":"validation","validationCode":"// Java: reject list-of-map columns before writing\nField elementField = listField.getChildren().get(0);\nif (elementField.getType() instanceof ArrowType.Map) {\n    throw new IllegalArgumentException(\"array<map> unsupported; use array<struct> or JSON strings\");\n}","typeGuard":"boolean isSupportedListElement(ArrowType t) {\n    return !(t instanceof ArrowType.Map);\n}","tryCatchPattern":null,"preventionTips":["Model arrays of objects as array<struct<...>> instead of array<map<...>>","Serialize nested JSON into strings when in doubt","Validate element types against the supported matrix at schema design time"],"tags":["lance","arrow","nested-type","list","map","sink"],"backgroundTag":"unsupported-operation","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"}