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 exceeds the maximum scale of {}, it will be converted to decimal({},{})

What it means

In MaxComputeTypeConverter.reconvert, when the SeaTunnel decimal scale exceeds MAX_SCALE, the converter caps scale at MAX_SCALE (precision unchanged) and logs this warning. Extra fractional digits beyond MAX_SCALE will be truncated/rounded, causing precision loss on write.

Source

Thrown at seatunnel-connectors-v2/connector-maxcompute/src/main/java/org/apache/seatunnel/connectors/seatunnel/maxcompute/datatype/MaxComputeTypeConverter.java:408

                            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,
                            precision,
                            scale);
                }

                String decimalTypeStr = String.format("%s(%s,%s)", DECIMAL, precision, scale);
                builder.nativeType(TypeInfoFactory.getDecimalTypeInfo((int) precision, scale));
                builder.columnType(decimalTypeStr);
                builder.dataType(DECIMAL);
                builder.precision(precision);
                builder.scale(scale);
                break;

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Round upstream to fewer fractional digits (e.g. CAST(col AS DECIMAL(38,18))) before the sink
  2. Change the sink schema scale to MAX_SCALE explicitly
  3. If full fractional precision is required, use a STRING column instead of DECIMAL
  4. Confirm the truncation rounding behavior matches business expectations

Example fix

// before
new DecimalType(38, 25) // scale exceeds MAX_SCALE, truncated
// after
CAST(col AS DECIMAL(38, 18)) AS col
Defensive patterns

Strategy: validation

Validate before calling

DecimalType dt = (DecimalType) column.getDataType();
if (dt.getScale() > 18) System.out.println("Column " + column.getName() + " scale will be truncated; round upstream");

Type guard

if (column.getDataType() instanceof DecimalType dt) { return dt.getScale() <= 18; } return true;

Prevention

When it happens

Trigger: reconvert called with a DecimalType whose scale is greater than MAX_SCALE, e.g. decimal(38, 25) where the connector caps scale lower.

Common situations: High-precision financial data; upstream multiplication/division raising scale; declaring decimal with more fractional digits than MaxCompute/connector supports.

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


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/db55cefa0b688695. Report an issue: GitHub.