apache/seatunnel · error · UnsupportedOperationException

List type should be handled via FragmentConverter.writeListT

Error message

List type should be handled via FragmentConverter.writeListToVector

What it means

ListTypeWriter.writeToVector is intentionally a stub: list-typed values are written by FragmentConverter.writeListToVector, which creates list vectors directly, not through the per-field writer's writeToVector. Calling it always throws UnsupportedOperationException. It indicates a routing bug: list data was dispatched to the generic vector writer instead of the fragment converter.

Source

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

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;

/** 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) {

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Route list-typed fields through FragmentConverter.writeListToVector instead of the writer's writeToVector.
  2. If hit inside the connector during flushBatch, it is an internal routing bug — report it / upgrade the connector version.
  3. In custom code, check field.getType() instanceof ArrowType.List before choosing a writer path.

Example fix

// before
writer.writeToVector(listVector, arrowType, value, rowIndex, allocator);
// after
FragmentConverter.writeListToVector(listVector, arrowType, value, rowIndex, allocator);
Defensive patterns

Strategy: type-guard

Validate before calling

if (field.getType() instanceof ArrowType.List) { // must use FragmentConverter path, not writeToVector }

Type guard

static boolean isListField(org.apache.arrow.vector.types.pojo.Field f) { return f.getType() instanceof ArrowType.List; }

Try / catch

try { writer.writeToVector(vec, arrowType, value, idx, allocator); } catch (UnsupportedOperationException e) { if (e.getMessage().contains("FragmentConverter.writeListToVector")) { FragmentConverter.writeListToVector(vec, arrowType, value, idx, allocator); return; } throw e; }

Prevention

When it happens

Trigger: Calling ListTypeWriter.writeToVector directly (or a generic dispatch that passes an ArrowType.List field vector into it) instead of using FragmentConverter.writeListToVector for list columns.

Common situations: Custom code iterating row fields and calling the generic writer per field without special-casing list types; a code path bypassing FragmentConverter.reconvert.

Related errors


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