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

WARN log from SapHanaTypeConverter.reconvert. When a DECIMAL column's scale is negative (invalid), the converter resets scale to 0 and logs this warning; the generated decimal(p,s) DDL uses scale 0, so fractional data would be rounded/truncated on write.

Solutions

  1. Cast the column to an explicit decimal with non-negative scale before the sink
  2. Pre-create the SAP HANA table with the intended DECIMAL(p,s)
  3. Accept scale=0 only if integer values are expected

Example fix

// before: DECIMAL(10,-2)
// after: transform cast
// sql = "SELECT CAST(v AS DECIMAL(10,2)) AS v FROM src"
Defensive patterns

Strategy: validation

Validate before calling

if (decimalType.getScale() < 0) {
    // CAST(v AS DECIMAL(p, 0 or greater)) before the sink
}

Type guard

boolean hasNonNegativeScale(DecimalType t) { return t.getScale() >= 0; }

Prevention

When it happens

Trigger: Sink-side mapping where DecimalType.getScale() < 0; raised in reconvert() after the precision checks.

Common situations: Sources reporting negative scale metadata (rare; some engines allow negative scale concepts like NUMBER(38,-2)) fed into SAP HANA sink auto table creation.

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

Appendix: source

Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/saphana/SapHanaTypeConverter.java:384

                            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)