apache/seatunnel · error · UnsupportedOperationException

Unsupported type: ${clazz}

Error message

Unsupported type: ${clazz}

What it means

getBytesForValue has a second overload switch on the Java class of the field value (used when no explicit SeaTunnelDataType is supplied). The default branch throws UnsupportedOperationException when the field's runtime class has no size-accounting rule, meaning the row cannot estimate this value's serialized size.

Source

Thrown at seatunnel-api/src/main/java/org/apache/seatunnel/api/table/type/SeaTunnelRow.java:393

                return rowSize;
            default:
                if (v.getClass().isArray() && v instanceof Object[]) {
                    int sum = 0;
                    for (Object o : (Object[]) v) {
                        sum += getBytesForValue(o);
                    }
                    return sum;
                }
                if (v instanceof Map) {
                    int mapSize = 0;
                    for (Map.Entry<?, ?> entry : ((Map<?, ?>) v).entrySet()) {
                        mapSize +=
                                getBytesForValue(entry.getKey())
                                        + getBytesForValue(entry.getValue());
                    }
                    return mapSize;
                }
                throw new UnsupportedOperationException("Unsupported type: " + clazz);
        }
    }

    /** Compares only the stain trace payload carried in row options. */
    public boolean hasSameTracePayload(SeaTunnelRow that) {
        if (that == null) {
            return false;
        }
        return Arrays.equals(getTracePayload(), that.getTracePayload());
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof SeaTunnelRow)) {
            return false;

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Convert the field value to a standard SeaTunnel-supported Java type (String, byte[], Integer, etc.) before putting it in the row
  2. Supply an explicit SeaTunnelDataType (ArrayType/MapType etc.) so the type-based branch is used instead of the class-based one
  3. Upgrade SeaTunnel if the type is a standard type added in a newer release
  4. Exclude unsupported fields from the row or compute their size externally

Example fix

// before
row.setField(1, myCustomPojo);
int size = row.getBytesSize(); // throws: Unsupported type: com.app.MyPojo
// after
row.setField(1, objectMapper.writeValueAsBytes(myCustomPojo)); // byte[] is supported
Defensive patterns

Strategy: validation

Validate before calling

boolean allKnown = Arrays.stream(row.getFields())
    .allMatch(f -> f == null || f instanceof String || f instanceof Boolean || f instanceof Number
        || f instanceof byte[] || f instanceof Map || f instanceof Object[] || f instanceof SeaTunnelRow);

Try / catch

try {
    int size = row.getBytesSize();
} catch (UnsupportedOperationException e) {
    int size = estimateWithKnownTypesOnly(row);
}

Prevention

When it happens

Trigger: Calling getBytesSize() on a row whose field value is an unrecognized Java class (e.g. a custom POJO, BigDecimal variant, or exotic object not in the known class list) in the class-based branch of getBytesForValue.

Common situations: Putting application POJOs or third-party types into SeaTunnelRow fields; upstream data converted to non-standard Java types by a custom source; version drift where a new Java type maps into an old size estimator.

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


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