apache/seatunnel · error · UnsupportedOperationException

List as map key is not supported

Error message

List as map key is not supported

What it means

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.

Source

Thrown at seatunnel-connectors-v2/connector-lance/src/main/java/org/apache/seatunnel/connectors/seatunnel/lance/sink/writers/ListTypeWriter.java:48

            FieldVector vector,
            ArrowType arrowType,
            Object value,
            int rowIndex,
            BufferAllocator allocator) {
        throw new UnsupportedOperationException(
                "List type should be handled via FragmentConverter.writeListToVector");
    }

    @Override
    public void writeToListWriter(
            UnionListWriter writer, ArrowType arrowType, Object value, BufferAllocator allocator) {
        throw new UnsupportedOperationException("Nested list writing not yet implemented");
    }

    @Override
    public void writeToMapKey(
            UnionMapWriter writer, ArrowType arrowType, Object value, BufferAllocator allocator) {
        throw new UnsupportedOperationException("List as map key is not supported");
    }

    @Override
    public void writeToMapValue(
            UnionMapWriter writer, ArrowType arrowType, Object value, BufferAllocator allocator) {
        throw new UnsupportedOperationException("List as map value not yet implemented");
    }
}

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Change the map key type in the SeaTunnel schema to a scalar type (STRING, INT, etc.) — Arrow does not allow list keys.
  2. 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.
  3. Restructure the data as a list of structs (LIST<STRUCT<key-fields, value>>) instead of a map with composite keys.
  4. Track the Lance connector for future support; the surrounding methods are marked 'not yet implemented'.

Example fix

// before: schema with map key as array
columns = "info map<array<string>, string>"

// after: use scalar key
columns = "info map<string, string>"
Defensive patterns

Strategy: validation

Validate before calling

// Java: before writing, check map key type is scalar
if (mapFieldType.getChildren().get(0).getType() instanceof ArrowType.List) {
    throw new IllegalArgumentException("map key cannot be a list; use a scalar key type");
}

Type guard

boolean isScalarArrowType(ArrowType t) {
    return t instanceof ArrowType.Int || t instanceof ArrowType.FloatingPoint
        || t instanceof ArrowType.Utf8 || t instanceof ArrowType.Binary
        || t instanceof ArrowType.Bool || t instanceof ArrowType.Date
        || t instanceof ArrowType.Time || t instanceof ArrowType.TimeStamp;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

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


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/722192d9a4cd6597. Report an issue: GitHub.