{"record":{"id":"df9d16e98263ea30","repo":"apache/seatunnel","slug":"the-decimal-column-type-decimal-is-out-o-df9d16","errorCode":null,"errorMessage":"The decimal column {} type decimal({},{}) is out of range, which exceeds the maximum scale of {}, it will be converted to decimal({},{})","messagePattern":"The decimal column (.+?) type decimal\\((.+?),(.+?)\\) is out of range, which exceeds the maximum scale of (.+?), 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/db2/DB2TypeConverter.java","lineNumber":306,"sourceCode":"                            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,\n                            precision,\n                            scale);\n                }\n\n                builder.columnType(String.format(\"%s(%s,%s)\", DB2_DECIMAL, precision, scale));\n                builder.dataType(DB2_DECIMAL);\n                builder.precision(precision);\n                builder.scale(scale);\n                break;\n            case BYTES:\n                if (column.getColumnLength() == null || column.getColumnLength() <= 0) {","sourceCodeStart":288,"sourceCodeEnd":324,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/db2/DB2TypeConverter.java#L288-L324","documentation":"DB2 limits decimal scale to MAX_PRECISION - 1 = 30. When reconvert sees a scale greater than 30, it clamps scale to 30 and logs this warning, converting to decimal(p,30). Digits beyond the retained scale will be truncated/rounded on write.","triggerScenarios":"reconvert receives a column like decimal(38,38) or decimal(20,35), where scale exceeds 30 — typical of high-precision financial sources or NUMERIC with scale == precision.","commonSituations":"Syncing high-scale financial columns (e.g. Postgres NUMERIC(38,38)) into DB2; source schemas auto-generated with scale equal to precision; schema evolution importing very precise columns.","solutions":["Reduce the source scale to <= 30 (e.g. DECIMAL(38,30)) or use a transform to round the values","Define an explicit sink schema for the column with an acceptable scale","Accept the clamped decimal(p,30) after verifying downstream precision tolerance","Consider a sink that supports larger scales if exact precision is required"],"exampleFix":"// before\nNUMERIC(38, 38)\n// after (DB2-compatible)\nNUMERIC(38, 30)","handlingStrategy":"validation","validationCode":"// before write\nDecimalType dt = (DecimalType) column.getDataType();\nif (dt.getScale() > 30) {\n    throw new IllegalArgumentException(\"Scale \" + dt.getScale() + \" exceeds DB2 max 30 for column \" + column.getName());\n}","typeGuard":"boolean fitsDb2Scale(DecimalType dt) {\n    return dt.getScale() <= 30;\n}","tryCatchPattern":null,"preventionTips":["Keep decimal scale <= 30 when targeting DB2","Avoid scale == precision schemas for high-precision financial data","Round values in a transform to control truncation semantics","Validate sink limits against source DDL during pipeline design"],"tags":["jdbc","db2","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-14T05:17:10.506Z"}