apache/seatunnel · error · UnsupportedOperationException
Unsupported convert ${value.getClass()} to BigDecimal
Error message
Unsupported convert ${value.getClass()} to BigDecimal What it means
The typeDefine-less convertDecimal(Object) handles Number and String values only; anything else causes UnsupportedOperationException naming the value's class. It indicates the DECIMAL conversion has no rule for that runtime type.
Source
Thrown at seatunnel-api/src/main/java/org/apache/seatunnel/api/table/converter/BasicDataConverter.java:847
default BigDecimal convertDecimal(T typeDefine, Number value) {
return convertDecimal(value);
}
default BigDecimal convertDecimal(T typeDefine, String value) {
return convertDecimal(value);
}
default BigDecimal convertDecimal(Object value) throws UnsupportedOperationException {
if (value instanceof BigDecimal) {
return (BigDecimal) value;
}
if (value instanceof Number) {
return convertDecimal((Number) value);
}
if (value instanceof String) {
return convertDecimal((String) value);
}
throw new UnsupportedOperationException(
"Unsupported convert " + value.getClass() + " to BigDecimal");
}
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);
}View on GitHub (pinned to cf67b549a7)
Solutions
- Pre-convert to BigDecimal, another Number, or a plain numeric String before calling convert
- Add a custom converter branch for the class named in the message
- Correct the source mapping so the field deserializes to a numeric type
Example fix
// before converter.convert(rawDecimalBuffer); // throws // after BigDecimal bd = new BigDecimal(new String(rawDecimalBuffer)); converter.convert(bd);
Defensive patterns
Strategy: type-guard
Validate before calling
if (!(v instanceof Number) && !(v instanceof String)) {
throw new IllegalStateException("Unsupported decimal class: " + v.getClass());
} Type guard
boolean isConvertibleToDecimal(Object v) {
return v instanceof Number || v instanceof String;
} Try / catch
try {
converter.convert(value);
} catch (UnsupportedOperationException e) {
LOG.warn("Decimal convert failed, class={}", value.getClass(), e);
value = normalizeToDecimal(value);
} Prevention
- Pre-convert custom decimal wrappers to BigDecimal
- Avoid forwarding raw buffers/Objects through transforms
- Re-verify deserialization classes after upstream version changes
When it happens
Trigger: Calling convert()/convertDecimal(Object) with unhandled classes such as byte[], char[], or custom decimal wrappers for a DECIMAL column.
Common situations: Custom connectors passing raw binary decimal buffers; upstream version changes altering deserialization classes; mistakenly passing structured objects instead of scalars.
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 ${value.getClass()} to BigDecimal, typeD
- Unsupported convert ${value.getClass()} to LocalTime, typeDe
- Unsupported convert ${value.getClass()} to LocalTime
- Unsupported convert ${value.getClass()} to LocalDate, typeDe
- Unsupported convert ${value.getClass()} to LocalDate
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/e8ecfbe49a543a56.
Report an issue: GitHub.