apache/seatunnel · error · java.lang.UnsupportedOperationException
Unsupported type %s for numeric plus.
Error message
Unsupported type %s for numeric plus.
What it means
ObjectUtils.plus increments a numeric split-position value (e.g. split bounds for numeric primary keys) by an augend. It supports Integer, Long, BigInteger and BigDecimal; any other Number type reaches the else branch and throws UnsupportedOperationException naming the actual type. This ensures numeric split ranges are computed with exact arithmetic.
Source
Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-base/src/main/java/org/apache/seatunnel/connectors/cdc/base/utils/ObjectUtils.java:40
/** Utilities for operation on {@link Object}. */
public class ObjectUtils {
/**
* Returns a number {@code Object} whose value is {@code (number + augend)}, Note: This method
* will throw {@link ArithmeticException} if number overflows.
*/
public static Object plus(Object number, int augend) throws ArithmeticException {
if (number instanceof Integer) {
return Math.addExact((Integer) number, augend);
} else if (number instanceof Long) {
return Math.addExact((Long) number, augend);
} else if (number instanceof BigInteger) {
return ((BigInteger) number).add(BigInteger.valueOf(augend));
} else if (number instanceof BigDecimal) {
return ((BigDecimal) number).add(BigDecimal.valueOf(augend));
} else {
throw new UnsupportedOperationException(
String.format(
"Unsupported type %s for numeric plus.",
number.getClass().getSimpleName()));
}
}
/** Returns the difference {@code BigDecimal} whose value is {@code (minuend - subtrahend)}. */
public static BigDecimal minus(Object minuend, Object subtrahend) {
if (!minuend.getClass().equals(subtrahend.getClass())) {
throw new IllegalStateException(
String.format(
"Unsupported operand type, the minuend type %s is different with subtrahend type %s.",
minuend.getClass().getSimpleName(),
subtrahend.getClass().getSimpleName()));
}
if (minuend instanceof Integer) {
return BigDecimal.valueOf((int) minuend).subtract(BigDecimal.valueOf((int) subtrahend));
} else if (minuend instanceof Short) {View on GitHub (pinned to cf67b549a7)
Solutions
- Use an integral primary-key column (INT/BIGINT/DECIMAL) for the snapshot split key; avoid FLOAT/DOUBLE primary keys.
- If the PK is decimal, ensure the driver maps it to BigDecimal (supported) rather than Double.
- Patch ObjectUtils.plus to handle the missing Number type if you control the fork, converting via longValueExact or BigDecimal.valueOf.
- Configure the connector to split on a different supported column via the split key option if available.
Example fix
// before: unsupported float PK causes throw
} else if (number instanceof Double) {
throw new UnsupportedOperationException(...);
}
// after
} else if (number instanceof Double) {
return number.doubleValue() + augend;
} else { Defensive patterns
Strategy: validation
Validate before calling
// ensure the split key column is an exact numeric type before job start // SELECT data_type FROM information_schema.columns // WHERE table_name=? AND column_name=?; // accept: INTEGER, BIGINT, DECIMAL/NUMERIC
Try / catch
try {
Object next = ObjectUtils.plus(upperBound, 1);
} catch (UnsupportedOperationException e) {
log.error("Unsupported PK type for splitting: {}", e.getMessage());
} Prevention
- Choose INT/BIGINT/DECIMAL primary-key columns for chunked CDC reads.
- Avoid FLOAT/DOUBLE primary keys on captured tables.
- Verify driver-to-Java type mapping for unsigned/exotic numeric types.
When it happens
Trigger: A numeric primary-key column whose JDBC-reported type maps to a Number subclass outside the supported set (e.g. Float/Double, or a driver-specific numeric type), and the connector computes the next split upper bound via ObjectUtils.plus.
Common situations: Primary key column of floating type (FLOAT/DOUBLE) used for chunked snapshot reading; exotic driver types (e.g. unsigned BIGINT mapped unusually); custom table list with a non-integer numeric PK.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Unsupported type %s for numeric minus.
- Unsupported type:
- Unsupported SQL type:
- Unsupported BYTES value type:
- Unable to convert to LocalTime from unexpected value '' of t
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/a56a5669844f2b51.
Report an issue: GitHub.