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

What it means

WARN log from SapHanaTypeConverter.reconvert. When a DECIMAL column's precision exceeds SAP HANA's MAX_PRECISION, the converter reduces precision to the max and correspondingly shrinks the scale (scale = max(0, scale - (precision - MAX_PRECISION))), logging this warning. The generated DDL uses the clamped values, so high-precision data may lose scale or fail on write.

Solutions

  1. Reduce the source decimal precision to <= MAX_PRECISION via a cast before the sink
  2. Pre-create the SAP HANA table with a valid DECIMAL(p,s) that fits
  3. Accept the clamped precision/scale after verifying no precision loss matters

Example fix

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

Strategy: validation

Validate before calling

if (decimalType.getPrecision() > maxPrecision /* 38 for HANA */) {
    // CAST(v AS DECIMAL(38, s')) where s' keeps needed scale
}

Type guard

boolean precisionFits(DecimalType t, int max) { return t.getPrecision() <= max; }

Prevention

When it happens

Trigger: Auto table creation for a SAP HANA sink where DecimalType.getPrecision() > MAX_PRECISION (HANA allows max 38); raised in reconvert().

Common situations: Copying DECIMAL(40+) or very wide decimals from engines/formats that allow larger precision (or malformed metadata claiming huge precision) into SAP HANA.

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/aa69fc080414fad9. 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:371

                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)