apache/seatunnel · error · UnsupportedOperationException

Unsupported convert to Double, typeDefine

Error message

Unsupported convert ${value.getClass()} to Double, typeDefine: ${typeDefine}

What it means

convertDouble(TypeDefine, Object) supports Number and parseable String inputs; any other class triggers UnsupportedOperationException including the target typeDefine. The converter throws because a DOUBLE target requires a numeric or numeric-string value and the provided value is neither.

Solutions

  1. Identify the class from the message and pre-convert to a Number or plain numeric String
  2. Fix the schema mapping so the field arrives as a numeric type
  3. Add a custom DataConverter branch if the source consistently emits that class

Example fix

// before
converter.convert(doubleTypeDefine, bitValue); // Boolean
// after
double d = ((Boolean) bitValue) ? 1.0 : 0.0;
converter.convert(doubleTypeDefine, d);
Defensive patterns

Strategy: type-guard

Validate before calling

if (!(v instanceof Number) && !(v instanceof String)) {
    throw new IllegalStateException("Unsupported double class: " + v.getClass());
}

Type guard

boolean isDoubleLike(Object v) {
    return v instanceof Number || v instanceof String;
}

Try / catch

try {
    converter.convert(typeDefine, value);
} catch (UnsupportedOperationException e) {
    LOG.warn("Double conversion failed for {}: {}", value.getClass(), e.getMessage());
    value = normalizeToNumber(value);
}

Prevention

When it happens

Trigger: Calling convert() for a DOUBLE/FLOAT column with a boolean, byte[] buffer, nested object, or other non-numeric non-string class.

Common situations: Bit/binary columns from CDC mapped to DOUBLE; schema drift where a numeric column now deserializes as an object; passing formatted strings with locale-specific separators.

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

Appendix: source

Thrown at seatunnel-api/src/main/java/org/apache/seatunnel/api/table/converter/BasicDataConverter.java:869

    default BigDecimal convertDecimal(Number value) {
        return new BigDecimal(value.doubleValue());
    }

    default BigDecimal convertDecimal(String value) {
        return new BigDecimal(value);
    }

    default double convertDouble(T typeDefine, Object value) throws UnsupportedOperationException {
        if (value instanceof Double) {
            return (double) value;
        }
        if (value instanceof Number) {
            return convertDouble(typeDefine, (Number) value);
        }
        if (value instanceof String) {
            return convertDouble(typeDefine, (String) value);
        }
        throw new UnsupportedOperationException(
                "Unsupported convert "
                        + value.getClass()
                        + " to Double, typeDefine: "
                        + typeDefine);
    }

    default double convertDouble(T typeDefine, Number value) {
        return convertDouble(value);
    }

    default double convertDouble(T typeDefine, String value) {
        return convertDouble(value);
    }

    default double convertDouble(Object value) throws UnsupportedOperationException {
        if (value instanceof Double) {
            return (double) value;
        }

View on GitHub (pinned to cf67b549a7)