apache/seatunnel · warning

The decimal column type decimal( , ) is out of range, which…

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

Warning from YashanDbTypeConverter.reconvert when a DECIMAL column's scale is negative, which is invalid for YashanDB. The converter sets scale to 0 and continues, turning the column into an integer-valued decimal; only this warning is logged.

Solutions

  1. Remove the negative scale at the source: CAST(col AS DECIMAL(10,0)).
  2. Accept the scale=0 conversion if truncation of the rounded value semantics is acceptable.
  3. Define the YashanDB target column explicitly as DECIMAL(p,0).

Example fix

// before: decimal(10,-3)
// after
SQL: CAST(col AS DECIMAL(10,0)) AS col
Defensive patterns

Strategy: validation

Validate before calling

DecimalType d = (DecimalType) col.getDataType();
if (d.getScale() < 0) {
    col = col.copy().setDataType(new DecimalType(d.getPrecision(), 0)).build();
}

Type guard

boolean nonNegativeScale(DecimalType d) { return d.getScale() >= 0; }

Prevention

When it happens

Trigger: Sink write of a DecimalType with negative scale (e.g. DECIMAL(10,-3), produced by some engines to mean rounding to thousands) into YashanDB.

Common situations: Schemas coming from engines that permit negative scale (Spark/Hive-style decimal(10,-3)); metadata round-trips that preserve 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/0cea9df535f06a27. Report an issue: GitHub.

Appendix: source

Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/yashandb/YashanDbTypeConverter.java:383

                            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)