apache/seatunnel · error · UnsupportedOperationException

Nested list writing not yet implemented

Error message

Nested list writing not yet implemented

What it means

ListTypeWriter.writeToListWriter (used for nested list values inside UnionListWriter, e.g. list<list<...>> or lists reached via writeToMapValue) is not implemented and always throws UnsupportedOperationException. The connector supports only top-level lists via FragmentConverter; nesting lists inside lists or inside map values is unsupported.

Source

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

import org.apache.arrow.vector.types.pojo.ArrowType;

/** Writer for List type - placeholder, actual implementation handled separately. */
public class ListTypeWriter extends BaseTypeWriter {
    @Override
    public void writeToVector(
            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. Flatten the nested structure upstream (explode arrays in a transform, or serialize to JSON string) before the Lance sink.
  2. Change the target schema so lists are only at the top level.
  3. Track/upgrade the connector for nested-list support if it is implemented in a newer version.

Example fix

// before
row.setField(i, List.of(List.of(1, 2), List.of(3))); // list<list<int>>
// after
row.setField(i, List.of(1, 2, 3)); // flattened, or toJsonString for nested data
Defensive patterns

Strategy: validation

Validate before calling

// reject nested lists before writing
static void assertNoNestedLists(org.apache.arrow.vector.types.pojo.Schema s) { for (var f : s.getFields()) { var t = f.getType(); if (t instanceof ArrowType.List && ((org.apache.arrow.vector.complex.ListVector) null) != null) {} if (isNestedList(f)) throw new IllegalArgumentException("nested list unsupported: " + f.getName()); } }

Type guard

static boolean isNestedList(org.apache.arrow.vector.types.pojo.Field f) { if (!(f.getType() instanceof ArrowType.List)) return false; return f.getChildren().stream().anyMatch(c -> c.getType() instanceof ArrowType.List); }

Try / catch

try { writer.write(row); } catch (UnsupportedOperationException e) { if (e.getMessage().contains("Nested list writing not yet implemented")) { /* flatten or serialize to JSON upstream */ } throw e; }

Prevention

When it happens

Trigger: Writing a row whose field is a list of lists (or a map value that is a list) so that the writer dispatches to writeToListWriter for the inner list.

Common situations: Source data with nested array columns (e.g. JSON arrays of arrays, nested protobuf repeated fields) being sunk to Lance; schema containing list<list<int>> or map<string, list<...>>.

Related errors


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