{"record":{"id":"c187d6aadf4d6304","repo":"apache/seatunnel","slug":"the-decimal-column-type-decimal-is-out-o-c187d6","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/phoenix/PhoenixTypeConverter.java","lineNumber":248,"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)\", PHOENIX_DECIMAL, precision, scale));\n                builder.dataType(PHOENIX_DECIMAL);\n                builder.precision(precision);\n                builder.scale(scale);\n                break;\n            case BYTES:\n                builder.columnType(PHOENIX_BINARY);","sourceCodeStart":230,"sourceCodeEnd":266,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/phoenix/PhoenixTypeConverter.java#L230-L266","documentation":"If a decimal column's scale exceeds Phoenix's supported MAX_SCALE during reconvert, the converter logs this warning and clamps the scale to MAX_SCALE while keeping (or already-clamped) precision. Extra fractional digits beyond MAX_SCALE are lost, introducing rounding when data is written to Phoenix.","triggerScenarios":"PhoenixTypeConverter.reconvert() on a DecimalType with scale > MAX_SCALE (e.g. DECIMAL(10,20) where scale exceeds Phoenix's max fractional digits).","commonSituations":"Sources declaring high-scale decimals (scientific/financial data) written to Phoenix; schema inference returning oversized scales.","solutions":["Reduce the source decimal scale to fit within MAX_SCALE in the catalog schema.","Round the column upstream (e.g. ROUND(col, maxScale) or CAST to a smaller decimal) before the Phoenix sink.","Verify from the warning that truncation to decimal(precision, MAX_SCALE) is acceptable for your use case.","Pick a sink that supports the required scale if the extra fractional digits are mandatory."],"exampleFix":"// before\nnew DecimalType(10, 20); // scale exceeds MAX_SCALE\n// after\nnew DecimalType(10, 6); // within MAX_SCALE","handlingStrategy":"validation","validationCode":"DecimalType dt = (DecimalType) col.getDataType();\nif (dt.getScale() > phoenixMaxScale) {\n    col = CatalogColumn.of(col.getName(), new DecimalType(dt.getPrecision(), phoenixMaxScale), col.isNullable(), col.getDefaultValue());\n}","typeGuard":"boolean fitsPhoenixScale(CatalogColumn c) {\n    return c.getDataType() instanceof DecimalType\n        && ((DecimalType) c.getDataType()).getScale() <= 6; // Phoenix max scale\n}","tryCatchPattern":null,"preventionTips":["CAST to a smaller scale before the Phoenix sink","Confirm business tolerance for rounding of fractional digits","Compare source and sink decimal capabilities during schema design"],"tags":["jdbc","phoenix","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-14T05:17:10.506Z"}