apache/seatunnel · error · UnsupportedOperationException
Unsupported convert ${value.getClass()} to Float, typeDefine
Error message
Unsupported convert ${value.getClass()} to Float, typeDefine: ${typeDefine} What it means
This UnsupportedOperationException is thrown by BasicDataConverter.convertFloat(T typeDefine, Object value) when the incoming value is neither a Number nor a String, so the converter has no rule to produce a float. SeaTunnel row converters call this when mapping a source field to a FLOAT column; the message names the actual Java class received and the type definition, so it identifies both the offending type and the target column type. It is a programming/schema mismatch, not a runtime failure that can be retried.
Source
Thrown at seatunnel-api/src/main/java/org/apache/seatunnel/api/table/converter/BasicDataConverter.java:916
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);
}
if (value instanceof String) {
return convertFloat(typeDefine, (String) value);
}
throw new UnsupportedOperationException(
"Unsupported convert " + value.getClass() + " to Float, typeDefine: " + typeDefine);
}
default float convertFloat(T typeDefine, Number value) {
return convertFloat(value);
}
default float convertFloat(T typeDefine, String value) {
return convertFloat(value);
}
default float convertFloat(Object value) throws UnsupportedOperationException {
if (value instanceof Float) {
return (float) value;
}
if (value instanceof Number) {
return convertFloat((Number) value);
}View on GitHub (pinned to cf67b549a7)
Solutions
- Inspect value.getClass() printed in the message and change the upstream schema/catalog so the field is typed as a numeric or string type compatible with FLOAT
- Add an explicit conversion before calling the converter (e.g. parse the value to a Number/String) or override convertFloat(T typeDefine, Object value) in a custom converter to handle the reported class
- If the value should be skipped/nulled, filter or null-check the field in the transform before conversion
Example fix
// before
float f = converter.convertFloat(typeDefine, row.getField(i)); // byte[] value throws
// after
Object v = row.getField(i);
float f = (v instanceof Number) ? converter.convertFloat(typeDefine, (Number) v)
: converter.convertFloat(typeDefine, new String((byte[]) v, StandardCharsets.UTF_8)); Defensive patterns
Strategy: type-guard
Validate before calling
Object v = row.getField(i);
if (!(v instanceof Number) && !(v instanceof String)) {
throw new IllegalArgumentException("Field " + i + " of type " + v.getClass() + " is not convertible to FLOAT");
} Type guard
static boolean isFloatConvertible(Object v) {
return v instanceof Number || v instanceof String;
} Try / catch
try {
f = converter.convertFloat(typeDefine, value);
} catch (UnsupportedOperationException e) {
LOG.warn("Non-convertible value {} for FLOAT column: {}", value, e.getMessage());
f = 0f; // or skip/null per business rule
} Prevention
- Always verify the value's runtime class against the target SeaTunnel physical type before scalar conversion
- Keep the catalog schema in sync with what the source connector actually deserializes
- Add unit tests for converters covering every field type your source can emit
- Prefer explicit transforms (e.g. cast in a transform step) over relying on default coercion for non-numeric types
When it happens
Trigger: Calling DataConverter.convertFloat(typeDefine, value) with a value object whose class is not java.lang.Number and not java.lang.String — e.g. a byte[] from a binary column, a LocalDate/LocalDateTime, a Map/Array from a struct field, or a BigDecimal subclass not expected by the converter — while the sink column is FLOAT.
Common situations: A schema mismatch between source and sink: a source connector deserializes a field as byte[]/Date/Object but the catalog says FLOAT; a custom transform passes raw deserialized objects (e.g. JSON nested objects) into a float column; column type changed in the target table without updating the catalog mapping.
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 Float
- Unsupported convert ${value.getClass()} to Long, typeDefine:
- Unsupported convert ${value.getClass()} to Long
- Unsupported convert ${value.getClass()} to Integer, typeDefi
- Unsupported convert ${value.getClass()} to Integer
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/be48b5504fa71b68.
Report an issue: GitHub.