{"record":{"id":"0a6fac9b9b79d1a9","repo":"apache/seatunnel","slug":"unsupported-operand-type-the-minuend-type-s-is-d-0a6fac","errorCode":null,"errorMessage":"Unsupported operand type, the minuend type %s is different with subtrahend type %s.","messagePattern":"Unsupported operand type, the minuend type (.+?) is different with subtrahend type (.+?)\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/utils/ObjectUtils.java","lineNumber":66,"sourceCode":"            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) {\n            return BigDecimal.valueOf((short) minuend)\n                    .subtract(BigDecimal.valueOf((short) subtrahend));\n        } else if (minuend instanceof Byte) {\n            return BigDecimal.valueOf((byte) minuend)\n                    .subtract(BigDecimal.valueOf((byte) subtrahend));\n        } else if (minuend instanceof Long) {\n            return BigDecimal.valueOf((long) minuend)\n                    .subtract(BigDecimal.valueOf((long) subtrahend));\n        } else if (minuend instanceof Float) {\n            return new BigDecimal(minuend.toString())","sourceCodeStart":48,"sourceCodeEnd":84,"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#L48-L84","documentation":"ObjectUtils.minus() requires minuend and subtrahend to be of exactly the same Java class. When their classes differ it throws IllegalStateException('Unsupported operand type, the minuend type %s is different with subtrahend type %s.') instead of implicitly coercing types.","triggerScenarios":"Calling ObjectUtils.minus(minuend, subtrahend) where minuend.getClass() != subtrahend.getClass(), e.g. Integer minus Long, or BigDecimal minus Double.","commonSituations":"Subtracting values from two different columns whose logical types differ (INTEGER vs BIGINT); mixing a literal (e.g. Integer) with a Long/BigDecimal column value in an arithmetic transform.","solutions":["Cast or convert both operands to a common type before calling minus, e.g. convert both to BigDecimal.","Align the SeaTunnel column types so both fields map to the same Java class.","In your transform, wrap the call in a class check: if (!a.getClass().equals(b.getClass())) normalize first."],"exampleFix":"// before\nObject diff = ObjectUtils.minus(intValue, longValue); // IllegalStateException\n// after\nBigDecimal diff = new BigDecimal(intValue.toString()).subtract(new BigDecimal(longValue.toString()));","handlingStrategy":"validation","validationCode":"if (!a.getClass().equals(b.getClass())) {\n    throw new IllegalArgumentException(\"operands must share a type: \"\n        + a.getClass().getSimpleName() + \" vs \" + b.getClass().getSimpleName());\n}","typeGuard":"boolean sameType(Object a, Object b) { return a.getClass().equals(b.getClass()); }","tryCatchPattern":"try {\n    return ObjectUtils.minus(minuend, subtrahend);\n} catch (IllegalStateException e) {\n    return new BigDecimal(minuend.toString()).subtract(new BigDecimal(subtrahend.toString()));\n}","preventionTips":["Normalize operands to a single type (e.g. BigDecimal) before subtraction.","Keep column types consistent across upstream tables in multi-table jobs.","Add schema assertions in tests for arithmetic transforms."],"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"}