apache/seatunnel · error · UnsupportedOperationException

Unsupported type: ${sqlType}

Error message

Unsupported type: ${sqlType}

What it means

getBytesForValue (called via getBytesSize) computes a field's byte size with a switch over the field's SqlType; the default branch throws UnsupportedOperationException for SqlTypes with no defined size accounting. It indicates a type whose serialized size the row implementation does not know how to estimate.

Source

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

                int size = 0;
                MapType<?, ?> mapType = ((MapType<?, ?>) dataType);
                for (Map.Entry<?, ?> entry : ((Map<?, ?>) v).entrySet()) {
                    size +=
                            getBytesForValue(entry.getKey(), mapType.getKeyType())
                                    + getBytesForValue(entry.getValue(), mapType.getValueType());
                }
                return size;
            case ROW:
                int rowSize = 0;
                SeaTunnelRowType rowType = ((SeaTunnelRowType) dataType);
                SeaTunnelDataType<?>[] types = rowType.getFieldTypes();
                SeaTunnelRow row = (SeaTunnelRow) v;
                for (int i = 0; i < types.length; i++) {
                    rowSize += getBytesForValue(row.fields[i], types[i]);
                }
                return rowSize;
            default:
                throw new UnsupportedOperationException("Unsupported type: " + sqlType);
        }
    }

    private int getBytesForArray(Object v, SeaTunnelDataType<?> dataType) {
        switch (dataType.getSqlType()) {
            case STRING:
                int s = 0;
                for (String i : ((String[]) v)) {
                    s += i == null ? 0 : i.length();
                }
                return s;
            case BOOLEAN:
                return getArrayNotNullSize((Boolean[]) v);
            case TINYINT:
                return getArrayNotNullSize((Byte[]) v);
            case SMALLINT:
                return getArrayNotNullSize((Short[]) v) * 2;
            case INT:

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Check which SqlType is unhandled and upgrade SeaTunnel to a version whose getBytesForValue covers it
  2. Avoid routing rows with that SqlType through getBytesSize/getBytes (use your own estimator)
  3. Flatten or convert the unsupported column type to a supported one in the schema
  4. If you maintain a fork, add the missing case to the switch

Example fix

// before
long bytes = row.getBytesSize(); // UnsupportedOperationException for new SqlType
// after
long bytes = isSizeAccountingSupported(rowType) ? row.getBytesSize() : fallbackSizeEstimate(row);
Defensive patterns

Strategy: try-catch

Validate before calling

SqlType t = dataType.getSqlType();
boolean covered = switch (t) { case STRING, BOOLEAN, TINYINT, SMALLINT, INT, BIGINT, FLOAT, DOUBLE, DECIMAL, TIME, TIMESTAMP, TIMESTAMP_TZ, DATE, BYTES, ROW, ARRAY, MAP -> true; default -> false; };

Try / catch

try {
    long size = row.getBytesSize();
} catch (UnsupportedOperationException e) {
    long size = fallbackSize(row); // own estimator for uncovered SqlTypes
}

Prevention

When it happens

Trigger: Computing row size for a row containing a field whose SqlType is not covered by the switch (e.g. certain nested or newer types like ARRAY/MAP variants in the outer switch) via getBytesSize() or getBytes().

Common situations: Newer SeaTunnel data types (e.g. newly added SqlTypes) used with an older row implementation; user-defined complex schemas streamed through size-accounting paths (checkpoint stats, serializers).

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