apache/seatunnel · error · UnsupportedOperationException
Unsupported convert to Double
Error message
Unsupported convert ${value.getClass()} to Double What it means
The typeDefine-less convertDouble(Object) accepts Number and String; an unhandled class causes UnsupportedOperationException naming the value's class. It signals there is no double conversion rule for the supplied runtime type.
Solutions
- Pre-convert the value to a Number or numeric String before calling convert
- Add a custom converter branch for the offending class
- Correct the source mapping so the field deserializes as a numeric type
Example fix
// before converter.convert(flag); // Boolean, throws // after double d = ((Boolean) flag) ? 1.0 : 0.0; converter.convert(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 isConvertibleToDouble(Object v) {
return v instanceof Number || v instanceof String;
} Try / catch
try {
converter.convert(value);
} catch (UnsupportedOperationException e) {
LOG.warn("Double convert failed, class={}", value.getClass(), e);
value = normalizeToNumber(value);
} Prevention
- Convert Boolean/structured values to numbers before conversion
- Cover all field classes in conversion unit tests
- Keep transform outputs scalar-typed to match target columns
When it happens
Trigger: Calling convert()/convertDouble(Object) with classes like byte[], char[], Boolean, or domain objects for a DOUBLE column.
Common situations: Custom transforms forwarding raw Objects; upstream format changes altering the deserialized class; mistakenly passing structured or boolean values where scalars are expected.
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
- Unsupported convert to Double, typeDefine
- COMMON-17
- Unsupported convert to BigDecimal, typeDefine
- Unsupported convert to BigDecimal
- Unsupported convert to Boolean, typeDefine
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/765fe9b60a26b5be.
Report an issue: GitHub.
Appendix: source
Thrown at seatunnel-api/src/main/java/org/apache/seatunnel/api/table/converter/BasicDataConverter.java:894
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;
}
if (value instanceof Number) {
return convertDouble((Number) value);
}
if (value instanceof String) {
return convertDouble((String) value);
}
throw new UnsupportedOperationException(
"Unsupported convert " + value.getClass() + " to Double");
}
default double convertDouble(Number value) {
return value.doubleValue();
}
default double convertDouble(String value) {
return Double.parseDouble(value);
}
default float convertFloat(T typeDefine, Object value) throws UnsupportedOperationException {
if (value instanceof Float) {
return (float) value;
}
if (value instanceof Number) {
return convertFloat(typeDefine, (Number) value);
}View on GitHub (pinned to cf67b549a7)