apache/seatunnel · error · UnsupportedOperationException
Unsupported convert to Short, typeDefine
Error message
Unsupported convert ${value.getClass()} to Short, typeDefine: ${typeDefine} What it means
Thrown by BasicDataConverter.convertShort(T typeDefine, Object value) when the value is neither a Number nor a String. Short conversion supports numeric widening/narrowing and string parsing; any other class is rejected with the value class and type definition in the message.
Solutions
- Convert the value to Number or String before conversion (e.g. Boolean ? (short)1 : (short)0, or decode the byte[])
- Fix the catalog/schema so the field type matches the source data (BOOLEAN, BYTES, etc. instead of SMALLINT)
- Override convertShort(T typeDefine, Object value) in a custom converter for the reported class
Example fix
// before
short s = converter.convertShort(typeDefine, row.getField(0)); // byte[] throws
// after
Object v = row.getField(0);
short s = (v instanceof byte[])
? ByteBuffer.wrap((byte[]) v).getShort()
: converter.convertShort(typeDefine, v); Defensive patterns
Strategy: type-guard
Validate before calling
Object v = row.getField(0);
if (!(v instanceof Number) && !(v instanceof String)) {
throw new IllegalArgumentException("Value " + v.getClass() + " is not convertible to SHORT");
} Type guard
static boolean isShortConvertible(Object v) {
return v instanceof Number || v instanceof String;
} Try / catch
try {
s = converter.convertShort(typeDefine, value);
} catch (UnsupportedOperationException e) {
LOG.warn("Inconvertible value {} for SMALLINT: {}", value, e.getMessage());
s = 0;
} Prevention
- Decode binary fields before SMALLINT conversion
- Keep catalog types aligned with source deserialization (BYTES stays BYTES)
- Add type assertions in transforms feeding numeric sink columns
When it happens
Trigger: Calling convertShort(typeDefine, value) with byte[], Boolean, LocalDate, Map or other non-numeric/non-string objects while mapping a field to a SMALLINT column.
Common situations: Source schema says binary/boolean but the sink expects SMALLINT; enum-like fields serialized as objects; catalog definitions that drifted from actual data types.
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 Boolean, typeDefine
- Unsupported convert to Boolean
- Unsupported convert to Byte
- Unsupported convert to Byte, typeDefine
- Unsupported convert to Float, typeDefine
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/8b7aba28dbf57dd7.
Report an issue: GitHub.
Appendix: source
Thrown at seatunnel-api/src/main/java/org/apache/seatunnel/api/table/converter/BasicDataConverter.java:1191
default int convertInt(LocalDateTime value) {
return (int) (value.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli() / 1000);
}
default int convertInt(LocalDate value) {
return (int) (value.atStartOfDay(ZoneId.systemDefault()).toInstant().toEpochMilli() / 1000);
}
default short convertShort(T typeDefine, Object value) throws UnsupportedOperationException {
if (value instanceof Short) {
return (short) value;
}
if (value instanceof Number) {
return convertShort(typeDefine, (Number) value);
}
if (value instanceof String) {
return convertShort(typeDefine, (String) value);
}
throw new UnsupportedOperationException(
"Unsupported convert " + value.getClass() + " to Short, typeDefine: " + typeDefine);
}
default short convertShort(T typeDefine, Number value) {
return convertShort(value);
}
default short convertShort(T typeDefine, String value) {
return convertShort(value);
}
default short convertShort(Object value) throws UnsupportedOperationException {
if (value instanceof Short) {
return (short) value;
}
if (value instanceof Number) {
return convertShort((Number) value);
}View on GitHub (pinned to cf67b549a7)