apache/seatunnel · error · java.lang.UnsupportedOperationException
Map type should be handled via FragmentConverter.writeMapToV
Error message
Map type should be handled via FragmentConverter.writeMapToVector
What it means
MapTypeWriter.writeToVector is deliberately unusable: MAP-typed columns in the Lance sink are not written through the generic per-column TypeWriter dispatch, but through the dedicated FragmentConverter.writeMapToVector code path. Hitting this throw means a map value was routed to the wrong writer path — an internal dispatch bug rather than a user data problem.
Source
Thrown at seatunnel-connectors-v2/connector-lance/src/main/java/org/apache/seatunnel/connectors/seatunnel/lance/sink/writers/MapTypeWriter.java:34
*/
package org.apache.seatunnel.connectors.seatunnel.lance.sink.writers;
import org.apache.arrow.memory.BufferAllocator;
import org.apache.arrow.vector.FieldVector;
import org.apache.arrow.vector.complex.impl.UnionListWriter;
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) {View on GitHub (pinned to cf67b549a7)
Solutions
- Inspect FragmentConverter.setVectorValue and ensure ArrowType.Map is checked BEFORE the generic TypeWriterFactory.getWriter dispatch so writeMapToVector is used.
- If you added a new write path, route Map-typed fields explicitly to FragmentConverter.writeMapToVector.
- File/verify a connector bug with the schema (field type map<...>) that triggered the wrong dispatch.
- As a workaround, convert the MAP column to a JSON string in the pipeline until the dispatch is fixed.
Example fix
// before (generic dispatch)
TypeWriter writer = TypeWriterFactory.getWriter(field.getType());
writer.writeToVector(vector, field.getType(), value, rowIndex, allocator);
// after (special-case map)
if (field.getType() instanceof ArrowType.Map) {
FragmentConverter.writeMapToVector(mapVector, field, value, rowIndex, allocator);
} else {
TypeWriterFactory.getWriter(field.getType()).writeToVector(vector, field.getType(), value, rowIndex, allocator);
} Defensive patterns
Strategy: try-catch
Validate before calling
// Java: ensure map fields are routed to the dedicated path
boolean mapHandledSpecially = field.getType() instanceof ArrowType.Map;
if (!mapHandledSpecially) { /* safe to use TypeWriterFactory */ } Try / catch
try {
writer.writeToVector(vector, arrowType, value, rowIndex, allocator);
} catch (UnsupportedOperationException e) {
if (e.getMessage().contains("FragmentConverter.writeMapToVector")) {
FragmentConverter.writeMapToVector((MapVector) vector, field, value, rowIndex, allocator);
} else { throw e; }
} Prevention
- Never call the generic TypeWriter dispatch for ArrowType.Map fields
- Keep the map special-case first in any dispatch code you add to FragmentConverter
- Add a unit test covering a map column through setVectorValue
When it happens
Trigger: FragmentConverter.setVectorValue (or a custom caller) calls TypeWriterFactory.getWriter for an ArrowType.Map field and invokes writeToVector instead of special-casing it with writeMapToVector.
Common situations: Any Lance sink write containing a MAP column where the converter's type dispatch fails to recognize the Map arrow type first; modifications to FragmentConverter that bypass the map branch.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- TABLE_DATASET_WRITE_ST_ROW_EXCEPTION
- List as map key is not supported
- List as map value not yet implemented
- Map in list writing not yet implemented
- Map as map key is not supported
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/7b694f756371b85a.
Report an issue: GitHub.