apache/seatunnel · error · java.lang.UnsupportedOperationException
Map in list writing not yet implemented
Error message
Map in list writing not yet implemented
What it means
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.
Source
Thrown at seatunnel-connectors-v2/connector-lance/src/main/java/org/apache/seatunnel/connectors/seatunnel/lance/sink/writers/MapTypeWriter.java:41
import org.apache.arrow.vector.complex.impl.UnionMapWriter;
import org.apache.arrow.vector.types.pojo.ArrowType;
public class MapTypeWriter extends BaseTypeWriter {
@Override
public void writeToVector(
FieldVector vector,
ArrowType arrowType,
Object value,
int rowIndex,
BufferAllocator allocator) {
throw new UnsupportedOperationException(
"Map type should be handled via FragmentConverter.writeMapToVector");
}
@Override
public void writeToListWriter(
UnionListWriter writer, ArrowType arrowType, Object value, BufferAllocator allocator) {
throw new UnsupportedOperationException("Map in list writing not yet implemented");
}
@Override
public void writeToMapKey(
UnionMapWriter writer, ArrowType arrowType, Object value, BufferAllocator allocator) {
throw new UnsupportedOperationException("Map as map key is not supported");
}
@Override
public void writeToMapValue(
UnionMapWriter writer, ArrowType arrowType, Object value, BufferAllocator allocator) {
throw new UnsupportedOperationException("Map as map value not yet implemented");
}
}
View on GitHub (pinned to cf67b549a7)
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.
Example fix
// before columns = "items array<map<string, string>>" // after: list of structs columns = "items array<struct<k string, v string>>"
Defensive patterns
Strategy: validation
Validate before calling
// Java: reject list-of-map columns before writing
Field elementField = listField.getChildren().get(0);
if (elementField.getType() instanceof ArrowType.Map) {
throw new IllegalArgumentException("array<map> unsupported; use array<struct> or JSON strings");
} Type guard
boolean isSupportedListElement(ArrowType t) {
return !(t instanceof ArrowType.Map);
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- List as map value not yet implemented
- Map as map key is not supported
- Map as map value not yet implemented
- TABLE_DATASET_WRITE_ST_ROW_EXCEPTION
- List type should be handled via FragmentConverter.writeListT
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/ae1db293e05e6ddd.
Report an issue: GitHub.