{"record":{"id":"b8b884f328e4877f","repo":"apache/seatunnel","slug":"unsupported-convert-value-getclass-to-double","errorCode":null,"errorMessage":"Unsupported convert ${value.getClass()} to Double, typeDefine: ${typeDefine}","messagePattern":"Unsupported convert (.+?) to Double, typeDefine: (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"seatunnel-api/src/main/java/org/apache/seatunnel/api/table/converter/BasicDataConverter.java","lineNumber":869,"sourceCode":"    default BigDecimal convertDecimal(Number value) {\n        return new BigDecimal(value.doubleValue());\n    }\n\n    default BigDecimal convertDecimal(String value) {\n        return new BigDecimal(value);\n    }\n\n    default double convertDouble(T typeDefine, Object value) throws UnsupportedOperationException {\n        if (value instanceof Double) {\n            return (double) value;\n        }\n        if (value instanceof Number) {\n            return convertDouble(typeDefine, (Number) value);\n        }\n        if (value instanceof String) {\n            return convertDouble(typeDefine, (String) value);\n        }\n        throw new UnsupportedOperationException(\n                \"Unsupported convert \"\n                        + value.getClass()\n                        + \" to Double, typeDefine: \"\n                        + typeDefine);\n    }\n\n    default double convertDouble(T typeDefine, Number value) {\n        return convertDouble(value);\n    }\n\n    default double convertDouble(T typeDefine, String value) {\n        return convertDouble(value);\n    }\n\n    default double convertDouble(Object value) throws UnsupportedOperationException {\n        if (value instanceof Double) {\n            return (double) value;\n        }","sourceCodeStart":851,"sourceCodeEnd":887,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/converter/BasicDataConverter.java#L851-L887","documentation":"convertDouble(TypeDefine, Object) supports Number and parseable String inputs; any other class triggers UnsupportedOperationException including the target typeDefine. The converter throws because a DOUBLE target requires a numeric or numeric-string value and the provided value is neither.","triggerScenarios":"Calling convert() for a DOUBLE/FLOAT column with a boolean, byte[] buffer, nested object, or other non-numeric non-string class.","commonSituations":"Bit/binary columns from CDC mapped to DOUBLE; schema drift where a numeric column now deserializes as an object; passing formatted strings with locale-specific separators.","solutions":["Identify the class from the message and pre-convert to a Number or plain numeric String","Fix the schema mapping so the field arrives as a numeric type","Add a custom DataConverter branch if the source consistently emits that class"],"exampleFix":"// before\nconverter.convert(doubleTypeDefine, bitValue); // Boolean\n// after\ndouble d = ((Boolean) bitValue) ? 1.0 : 0.0;\nconverter.convert(doubleTypeDefine, d);","handlingStrategy":"type-guard","validationCode":"if (!(v instanceof Number) && !(v instanceof String)) {\n    throw new IllegalStateException(\"Unsupported double class: \" + v.getClass());\n}","typeGuard":"boolean isDoubleLike(Object v) {\n    return v instanceof Number || v instanceof String;\n}","tryCatchPattern":"try {\n    converter.convert(typeDefine, value);\n} catch (UnsupportedOperationException e) {\n    LOG.warn(\"Double conversion failed for {}: {}\", value.getClass(), e.getMessage());\n    value = normalizeToNumber(value);\n}","preventionTips":["Map bit/boolean columns explicitly instead of to DOUBLE","Ensure numeric fields deserialize as Number subclasses","Strip locale-specific formatting before passing numeric strings"],"tags":["java","type-conversion","double","numeric"],"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"}