apache/seatunnel · warning
The decimal column {} type decimal({},{}) is out of range, w
Error message
The decimal column {} type decimal({},{}) is out of range, which is scale less than 0, it will be converted to decimal({},{}) What it means
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.
Source
Thrown at seatunnel-connectors-v2/connector-maxcompute/src/main/java/org/apache/seatunnel/connectors/seatunnel/maxcompute/datatype/MaxComputeTypeConverter.java:397
precision,
scale);
} else if (precision > MAX_PRECISION) {
scale = (int) Math.max(0, scale - (precision - MAX_PRECISION));
precision = MAX_PRECISION;
log.warn(
"The decimal column {} type decimal({},{}) is out of range, "
+ "which exceeds the maximum precision of {}, "
+ "it will be converted to decimal({},{})",
column.getName(),
decimalType.getPrecision(),
decimalType.getScale(),
MAX_PRECISION,
precision,
scale);
}
if (scale < 0) {
scale = 0;
log.warn(
"The decimal column {} type decimal({},{}) is out of range, "
+ "which is scale less than 0, "
+ "it will be converted to decimal({},{})",
column.getName(),
decimalType.getPrecision(),
decimalType.getScale(),
precision,
scale);
} else if (scale > MAX_SCALE) {
scale = MAX_SCALE;
log.warn(
"The decimal column {} type decimal({},{}) is out of range, "
+ "which exceeds the maximum scale of {}, "
+ "it will be converted to decimal({},{})",
column.getName(),
decimalType.getPrecision(),
decimalType.getScale(),
MAX_SCALE,View on GitHub (pinned to cf67b549a7)
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
Example fix
// before new DecimalType(45, 3) // scale trimmed below 0 -> clamped to 0 // after new DecimalType(38, 0) // cast upstream, no data surprise
Defensive patterns
Strategy: validation
Validate before calling
DecimalType dt = (DecimalType) column.getDataType();
int effScale = (int) Math.max(0, dt.getScale() - Math.max(0, dt.getPrecision() - 38));
if (effScale <= 0 && dt.getScale() > 0) System.out.println("Fractional digits will be dropped for column " + column.getName()); Type guard
if (column.getDataType() instanceof DecimalType dt) { return dt.getScale() >= 0 && dt.getPrecision() <= 38; } return false; Prevention
- 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
When it happens
Trigger: reconvert called with a DecimalType where precision overflow adjustment drives scale below 0, or a decimal declared directly with negative scale.
Common situations: decimal(40,5) trimmed to MAX_PRECISION losing 2 scale digits then further clamped; schemas generated with negative scales by upstream tools.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- The decimal column {} type decimal({},{}) is out of range, w
- The decimal column {} type decimal({},{}) is out of range, w
- The decimal column {} type decimal({},{}) is out of range, w
- The decimal column {} type decimal({},{}) is out of range, w
- {} will probably cause value overflow.
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/c2048af2f0d4ab32.
Report an issue: GitHub.