apache/seatunnel · error · java.lang.UnsupportedOperationException

Map as map value not yet implemented

Error message

Map as map value not yet implemented

What it means

MapTypeWriter.writeToMapValue rejects MAP values nested as values of another MAP in the Lance sink. Nested map-in-map writing is not implemented; the dispatch lands here and throws UnsupportedOperationException unconditionally.

Source

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

                "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

  1. Flatten nested maps to a single level with dotted/string-composed keys (e.g. "a.b.c" -> value).
  2. Serialize inner maps to JSON strings so the value type is STRING.
  3. Restructure as LIST<STRUCT<key, value>> for hierarchical data.
  4. Implement nested map value writing via the UnionMapWriter value-writer API in a fork.

Example fix

// before
columns = "attrs map<string, map<string, string>>"

// after: flattened keys
columns = "attrs map<string, string>"  // keys like "group.subgroup"
Defensive patterns

Strategy: validation

Validate before calling

// Java: reject nested map values
ArrowType valueType = mapField.getChildren().get(1).getType();
if (valueType instanceof ArrowType.Map) {
    throw new IllegalArgumentException("nested map values unsupported; flatten or JSON-encode");
}

Type guard

boolean isFlatMapValue(ArrowType t) {
    return !(t instanceof ArrowType.Map);
}

Prevention

When it happens

Trigger: A MAP column declared as map<K, map<K2, V2>>; when FragmentConverter writes each entry's value, dispatch reaches MapTypeWriter.writeToMapValue.

Common situations: Hierarchical config/attribute data (nested dictionaries) ingested into Lance; schemas migrated from systems with arbitrary JSON-like nesting.

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/fb0d4515364b2726. Report an issue: GitHub.