{"record":{"id":"722192d9a4cd6597","repo":"apache/seatunnel","slug":"list-as-map-key-is-not-supported","errorCode":null,"errorMessage":"List as map key is not supported","messagePattern":"List as map key is not supported","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":48,"sourceCode":"            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) {\n        throw new UnsupportedOperationException(\"List as map value not yet implemented\");\n    }\n}\n","sourceCodeStart":30,"sourceCodeEnd":57,"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#L30-L57","documentation":"ListTypeWriter.writeToMapKey is a placeholder in the Lance sink's Arrow type-writer dispatch. Arrow Map key vectors only support scalar key types, so writing a SeaTunnel ARRAY value into a map KEY slot is rejected outright. The method intentionally throws UnsupportedOperationException because there is no valid Arrow encoding for this operation.","triggerScenarios":"A SeaTunnel Lance sink row contains a MAP whose key type is defined as an ARRAY (list) type, and FragmentConverter dispatches the key value through UnionMapWriter, which routes to ListTypeWriter.writeToMapKey.","commonSituations":"Declaring a table schema in the job config where the map key column type is arrays instead of a scalar (string/int); upstream data pipelines that model composite keys as lists; schema evolution mistakes when the key field was changed to a nested type.","solutions":["Change the map key type in the SeaTunnel schema to a scalar type (STRING, INT, etc.) — Arrow does not allow list keys.","If a composite key is needed, serialize the list into a single delimited string (e.g. JSON or join) and use STRING as the map key.","Restructure the data as a list of structs (LIST<STRUCT<key-fields, value>>) instead of a map with composite keys.","Track the Lance connector for future support; the surrounding methods are marked 'not yet implemented'."],"exampleFix":"// before: schema with map key as array\ncolumns = \"info map<array<string>, string>\"\n\n// after: use scalar key\ncolumns = \"info map<string, string>\"","handlingStrategy":"validation","validationCode":"// Java: before writing, check map key type is scalar\nif (mapFieldType.getChildren().get(0).getType() instanceof ArrowType.List) {\n    throw new IllegalArgumentException(\"map key cannot be a list; use a scalar key type\");\n}","typeGuard":"boolean isScalarArrowType(ArrowType t) {\n    return t instanceof ArrowType.Int || t instanceof ArrowType.FloatingPoint\n        || t instanceof ArrowType.Utf8 || t instanceof ArrowType.Binary\n        || t instanceof ArrowType.Bool || t instanceof ArrowType.Date\n        || t instanceof ArrowType.Time || t instanceof ArrowType.TimeStamp;\n}","tryCatchPattern":null,"preventionTips":["Only ever use scalar key types in map columns for the Lance sink","Encode composite keys as delimited or JSON strings","Add a schema lint step in CI that rejects non-scalar map keys"],"tags":["lance","arrow","map-key","unsupported-type","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"}