{"record":{"id":"2cb1cc5ac5e5ddf4","repo":"apache/seatunnel","slug":"the-decimal-column-type-decimal-is-out-o-2cb1cc","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/snowflake/SnowflakeTypeConverter.java","lineNumber":244,"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":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/snowflake/SnowflakeTypeConverter.java#L226-L262","documentation":"While converting a DECIMAL column for Snowflake, the column's scale is negative, which Snowflake does not support. SeaTunnel resets the scale to 0 (keeping the resolved precision) and logs this warning, effectively converting to an integer-valued decimal.","triggerScenarios":"reconvert() sees DecimalType with scale < 0 — possible after precision clamping reduced scale below zero, or when source metadata declares a negative scale (some engines allow negative scale for rounding decimals).","commonSituations":"Sources like Oracle/MySQL with NUMBER(p,-n) or decimal columns with negative scale; downstream effect of error 3501's clamping logic on columns with small scale and huge precision.","solutions":["Use a non-negative scale on the source decimal column.","Pre-create the Snowflake table so no automatic conversion happens, and cast values explicitly.","Verify the data fits an integer-scaled decimal after rounding; if fractional parts matter, remap the column as STRING.","Accept the warning if rounding to scale 0 is acceptable."],"exampleFix":"// before\nnew DecimalType(10, -3)\n// after\nnew DecimalType(10, 0)","handlingStrategy":"validation","validationCode":"DecimalType dt = (DecimalType) column.getDataType();\nif (dt.getScale() < 0) {\n    log.warn(\"Column {} has negative scale {}; will become 0\",\n        column.getName(), dt.getScale());\n}","typeGuard":"boolean hasNonNegativeScale(Column c) {\n    return !(c.getDataType() instanceof DecimalType)\n        || ((DecimalType) c.getDataType()).getScale() >= 0;\n}","tryCatchPattern":null,"preventionTips":["Avoid negative-scale decimals (NUMBER(p,-n)) when targeting Snowflake","Round/normalize scale at the source before sync","Map such columns to STRING if rounding is unacceptable"],"tags":["jdbc","snowflake","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-23T08:17:48.524Z"}