{"record":{"id":"c2048af2f0d4ab32","repo":"apache/seatunnel","slug":"the-decimal-column-type-decimal-is-out-o-c2048a","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-maxcompute/src/main/java/org/apache/seatunnel/connectors/seatunnel/maxcompute/datatype/MaxComputeTypeConverter.java","lineNumber":397,"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":379,"sourceCodeEnd":415,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-maxcompute/src/main/java/org/apache/seatunnel/connectors/seatunnel/maxcompute/datatype/MaxComputeTypeConverter.java#L379-L415","documentation":"In MaxComputeTypeConverter.reconvert, after precision adjustments (which can subtract from scale), if the resulting scale is negative the converter clamps it to 0 and logs this warning. The column becomes an integer-valued decimal, silently dropping all fractional digits.","triggerScenarios":"reconvert called with a DecimalType where precision overflow adjustment drives scale below 0, or a decimal declared directly with negative scale.","commonSituations":"decimal(40,5) trimmed to MAX_PRECISION losing 2 scale digits then further clamped; schemas generated with negative scales by upstream tools.","solutions":["Reduce source precision so scale survives the MAX_PRECISION adjustment","Explicitly cast upstream to a decimal with non-negative scale that fits","If integer values are fine, accept the scale=0 conversion","Validate sink schema decimals (precision/scale bounds) before job submission"],"exampleFix":"// before\nnew DecimalType(45, 3) // scale trimmed below 0 -> clamped to 0\n// after\nnew DecimalType(38, 0) // cast upstream, no data surprise","handlingStrategy":"validation","validationCode":"DecimalType dt = (DecimalType) column.getDataType();\nint effScale = (int) Math.max(0, dt.getScale() - Math.max(0, dt.getPrecision() - 38));\nif (effScale <= 0 && dt.getScale() > 0) System.out.println(\"Fractional digits will be dropped for column \" + column.getName());","typeGuard":"if (column.getDataType() instanceof DecimalType dt) { return dt.getScale() >= 0 && dt.getPrecision() <= 38; } return false;","tryCatchPattern":null,"preventionTips":["Ensure precision headroom so scale survives the MAX_PRECISION trim","Reject negative or degenerate scales in schema validation","Cast to decimal with non-negative scale upstream"],"tags":["maxcompute","decimal","scale","type-conversion"],"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-14T11:17:12.474Z"}