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

What it means

In MaxComputeTypeConverter.reconvert, when the SeaTunnel decimal precision exceeds MAX_PRECISION, the converter trims the scale by the excess (scale -= precision - MAX_PRECISION, floored at 0), caps precision at MAX_PRECISION, and logs this warning. Values with more integer digits than the capped precision will overflow.

Source

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

                DecimalType decimalType = (DecimalType) column.getDataType();
                long precision = decimalType.getPrecision();
                int scale = decimalType.getScale();
                if (precision <= 0) {
                    precision = DEFAULT_PRECISION;
                    scale = DEFAULT_SCALE;
                    log.warn(
                            "The decimal column {} type decimal({},{}) is out of range, "
                                    + "which is precision less than 0, "
                                    + "it will be converted to decimal({},{})",
                            column.getName(),
                            decimalType.getPrecision(),
                            decimalType.getScale(),
                            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(),

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Cap the column precision in the pipeline before the sink (cast to a supported precision)
  2. Adjust the sink schema to decimal(MAX_PRECISION, scale)
  3. If fractional digits are lost due to scale trimming, reduce the source scale explicitly (e.g. CAST to decimal(38,8))
  4. Verify whether the truncated scale loses needed fractional digits and add rounding upstream

Example fix

// before
new DecimalType(45, 10) // exceeds MAX_PRECISION, scale trimmed
// after
new DecimalType(38, 3) // CAST upstream to fit
Defensive patterns

Strategy: validation

Validate before calling

DecimalType dt = (DecimalType) column.getDataType();
if (dt.getPrecision() > 38) {
    int newScale = (int) Math.max(0, dt.getScale() - (dt.getPrecision() - 38));
    System.out.println("Column will become decimal(38," + newScale + "), fractional digits may be lost");
}

Type guard

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

Prevention

When it happens

Trigger: reconvert called with a DecimalType whose precision is greater than MAX_PRECISION, e.g. decimal(45, 10) being converted back to a MaxCompute decimal type.

Common situations: Sinks declaring very wide decimals; aggregated decimal results whose precision grew beyond MaxCompute limits; mismatches between source and sink decimal capabilities.

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/ff2ec202e8dcd974. Report an issue: GitHub.