{"record":{"id":"8cc791ab6a82ca21","repo":"apache/seatunnel","slug":"unsupported-type-s-for-numeric-plus-8cc791","errorCode":null,"errorMessage":"Unsupported type %s for numeric plus.","messagePattern":"Unsupported type (.+?) for numeric plus\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/utils/ObjectUtils.java","lineNumber":56,"sourceCode":"            int result = Math.addExact((Short) number, augend);\n            if (result < Short.MIN_VALUE || result > Short.MAX_VALUE) {\n                throw new ArithmeticException(\"short overflow\");\n            }\n            return (short) result;\n        } else if (number instanceof Integer) {\n            return Math.addExact((Integer) number, augend);\n        } else if (number instanceof Long) {\n            return Math.addExact((Long) number, augend);\n        } else if (number instanceof Float) {\n            return ((Float) number) + augend;\n        } else if (number instanceof Double) {\n            return ((Double) number) + augend;\n        } else if (number instanceof BigInteger) {\n            return ((BigInteger) number).add(BigInteger.valueOf(augend));\n        } else if (number instanceof BigDecimal) {\n            return ((BigDecimal) number).add(BigDecimal.valueOf(augend));\n        } else {\n            throw new UnsupportedOperationException(\n                    String.format(\n                            \"Unsupported type %s for numeric plus.\",\n                            number.getClass().getSimpleName()));\n        }\n    }\n\n    /** Returns the difference {@code BigDecimal} whose value is {@code (minuend - subtrahend)}. */\n    public static BigDecimal minus(Object minuend, Object subtrahend) {\n        if (!minuend.getClass().equals(subtrahend.getClass())) {\n            throw new IllegalStateException(\n                    String.format(\n                            \"Unsupported operand type, the minuend type %s is different with subtrahend type %s.\",\n                            minuend.getClass().getSimpleName(),\n                            subtrahend.getClass().getSimpleName()));\n        }\n        if (minuend instanceof Integer) {\n            return BigDecimal.valueOf((int) minuend).subtract(BigDecimal.valueOf((int) subtrahend));\n        } else if (minuend instanceof Short) {","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/utils/ObjectUtils.java#L38-L74","documentation":"ObjectUtils.plus() only supports Byte, Short, Integer, Long, Float, Double, BigInteger and BigDecimal operands. If the number argument is any other type (e.g. String, SeaTunnelRow, Date), it throws UnsupportedOperationException('Unsupported type %s for numeric plus.').","triggerScenarios":"Calling ObjectUtils.plus(number, augend) where number's runtime class is none of the supported numeric types, so the final else branch is reached.","commonSituations":"A JDBC column mapped to an unexpected Java type (e.g. String-typed numeric column from a loosely typed source) is fed into plus() by a transform; custom types from another connector passed into the utility.","solutions":["Check the field's SeaTunnel type mapping and ensure the value is a numeric type before calling plus().","Convert the value explicitly first, e.g. new BigDecimal(value.toString()) or Long.parseLong(...).","Fix the source/catalog type mapping so numeric columns arrive as Integer/Long/BigDecimal instead of String or other types."],"exampleFix":"// before\nObject sum = ObjectUtils.plus(rawValue, 1); // rawValue is String -> UnsupportedOperationException\n// after\nObject numeric = rawValue instanceof Number ? rawValue : new BigDecimal(rawValue.toString());\nObject sum = ObjectUtils.plus(numeric, 1);","handlingStrategy":"type-guard","validationCode":"if (!(value instanceof Number)) {\n    throw new IllegalArgumentException(\"plus() requires a Number, got: \" + value.getClass());\n}","typeGuard":"boolean isSupportedNumeric(Object v) {\n    return v instanceof Byte || v instanceof Short || v instanceof Integer || v instanceof Long\n        || v instanceof Float || v instanceof Double || v instanceof BigInteger || v instanceof BigDecimal;\n}","tryCatchPattern":"try {\n    return ObjectUtils.plus(number, augend);\n} catch (UnsupportedOperationException e) {\n    return new BigDecimal(number.toString()).add(BigDecimal.valueOf(((Number) augend).doubleValue()));\n}","preventionTips":["Validate SeaTunnel column types map to numeric Java classes before arithmetic transforms.","Log the actual value class at transform entry to catch mapping surprises early.","Avoid feeding String-typed numeric columns into arithmetic utilities without conversion."],"tags":["type-error","jdbc","arithmetic"],"backgroundTag":"type-mismatch","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}