{"record":{"id":"4e3ed88fdec1e9fb","repo":"apache/seatunnel","slug":"the-decimal-column-type-decimal-is-out-o-4e3ed8","errorCode":null,"errorMessage":"The decimal column {} type decimal({},{}) is out of range, which is scale less than 0, it will be converted to decimal({},{})","messagePattern":"The decimal column (.+?) type decimal\\((.+?),(.+?)\\) is out of range, which is scale less than 0, it will be converted to decimal\\((.+?),(.+?)\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/saphana/SapHanaTypeConverter.java","lineNumber":384,"sourceCode":"                            precision,\n                            scale);\n                } else if (precision > MAX_PRECISION) {\n                    scale = (int) Math.max(0, scale - (precision - MAX_PRECISION));\n                    precision = MAX_PRECISION;\n                    log.warn(\n                            \"The decimal column {} type decimal({},{}) is out of range, \"\n                                    + \"which exceeds the maximum precision of {}, \"\n                                    + \"it will be converted to decimal({},{})\",\n                            column.getName(),\n                            decimalType.getPrecision(),\n                            decimalType.getScale(),\n                            MAX_PRECISION,\n                            precision,\n                            scale);\n                }\n                if (scale < 0) {\n                    scale = 0;\n                    log.warn(\n                            \"The decimal column {} type decimal({},{}) is out of range, \"\n                                    + \"which is scale less than 0, \"\n                                    + \"it will be converted to decimal({},{})\",\n                            column.getName(),\n                            decimalType.getPrecision(),\n                            decimalType.getScale(),\n                            precision,\n                            scale);\n                } else if (scale > MAX_SCALE) {\n                    scale = MAX_SCALE;\n                    log.warn(\n                            \"The decimal column {} type decimal({},{}) is out of range, \"\n                                    + \"which exceeds the maximum scale of {}, \"\n                                    + \"it will be converted to decimal({},{})\",\n                            column.getName(),\n                            decimalType.getPrecision(),\n                            decimalType.getScale(),\n                            MAX_SCALE,","sourceCodeStart":366,"sourceCodeEnd":402,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/saphana/SapHanaTypeConverter.java#L366-L402","documentation":"WARN log from SapHanaTypeConverter.reconvert. When a DECIMAL column's scale is negative (invalid), the converter resets scale to 0 and logs this warning; the generated decimal(p,s) DDL uses scale 0, so fractional data would be rounded/truncated on write.","triggerScenarios":"Sink-side mapping where DecimalType.getScale() < 0; raised in reconvert() after the precision checks.","commonSituations":"Sources reporting negative scale metadata (rare; some engines allow negative scale concepts like NUMBER(38,-2)) fed into SAP HANA sink auto table creation.","solutions":["Cast the column to an explicit decimal with non-negative scale before the sink","Pre-create the SAP HANA table with the intended DECIMAL(p,s)","Accept scale=0 only if integer values are expected"],"exampleFix":"// before: DECIMAL(10,-2)\n// after: transform cast\n// sql = \"SELECT CAST(v AS DECIMAL(10,2)) AS v FROM src\"","handlingStrategy":"validation","validationCode":"if (decimalType.getScale() < 0) {\n    // CAST(v AS DECIMAL(p, 0 or greater)) before the sink\n}","typeGuard":"boolean hasNonNegativeScale(DecimalType t) { return t.getScale() >= 0; }","tryCatchPattern":null,"preventionTips":["Sanitize source metadata that yields negative scale","Use explicit DECIMAL(p,s) casts in transforms","Pre-create tables instead of auto-generation when metadata is suspect"],"tags":["jdbc","saphana","type-conversion","decimal-scale"],"backgroundTag":"value-out-of-range","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"}