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

XuguTypeConverter.reconvert clamps negative decimal scale to 0. If a SeaTunnel DecimalType has scale < 0 (possible after precision-shrinking arithmetic or invalid upstream declarations), the converter logs this warning and forces scale = 0, discarding the fractional part semantics.

Source

Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/xugu/XuguTypeConverter.java:287

                            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

  1. Ensure declared scale is >= 0 on the source DecimalType
  2. Check upstream mapper arithmetic; reduce precision less aggressively or pre-cast the column
  3. Accept integer-only (scale 0) semantics if fractions are not needed

Example fix

// before
DecimalType d = new DecimalType(10, -2); // scale clamped to 0
// after
DecimalType d = new DecimalType(10, 0);
Defensive patterns

Strategy: validation

Validate before calling

if (decimalType.getScale() < 0) {
    throw new IllegalArgumentException("Column " + column.getName() + " decimal scale must be >= 0");
}

Prevention

When it happens

Trigger: Sink catalog conversion where a DecimalType ends with negative scale — either declared directly or resulting from the precision > MAX_PRECISION adjustment in the same method.

Common situations: Upstream mappers that compute scale = original_scale - (precision - max_precision) overshooting below zero; hand-built DecimalType with negative scale.

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