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

What it means

WARN log from SapHanaTypeConverter.reconvert. When a DECIMAL column's scale exceeds SAP HANA's MAX_SCALE, the converter clamps scale to the max and logs this warning; the generated decimal(p,s) DDL uses the clamped scale, so fractional precision beyond the cap is lost.

Solutions

  1. Cast the column to a supported decimal scale (e.g. DECIMAL(38,18)) before the sink
  2. Pre-create the SAP HANA table with a valid DECIMAL(p,s)
  3. Accept the clamped scale after validating rounding behavior

Example fix

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

Strategy: validation

Validate before calling

if (decimalType.getScale() > maxScale) {
    // CAST(v AS DECIMAL(p, maxScale)) before the sink
}

Type guard

boolean scaleFits(DecimalType t, int max) { return t.getScale() <= max; }

Prevention

When it happens

Trigger: Auto table creation for a SAP HANA sink where DecimalType.getScale() > MAX_SCALE; raised in reconvert().

Common situations: Sources with extremely high fractional precision (e.g. DECIMAL(38,40) from unusual metadata or engines permitting scale > precision) targeting 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/5d466d73cc02332e. 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:395

                            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,
                            precision,
                            scale);
                }
                builder.columnType(String.format("%s(%s,%s)", HANA_DECIMAL, precision, scale));
                builder.dataType(HANA_DECIMAL);
                builder.precision(precision);
                builder.scale(scale);
                break;
            case BYTES:
                builder.columnType(HANA_BLOB);
                builder.dataType(HANA_BLOB);

View on GitHub (pinned to cf67b549a7)