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

What it means

DB2 supports a maximum decimal precision of 31 (MAX_PRECISION). When reconvert sees a DecimalType whose precision exceeds 31, it clamps precision to 31 and shrinks the scale by the same overshoot (never below 0), logging this warning. Data with more significant digits than the converted type allows may lose precision or fail at write time.

Source

Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/db2/DB2TypeConverter.java:282

                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)

Solutions

  1. Reduce the source decimal precision to <= 31 (e.g. DECIMAL(31,8)) in the source DDL or schema transform
  2. Cast/downscale the column in a SeaTunnel transform before the sink
  3. Accept the clamped decimal(31,s) and verify application tolerance for reduced precision
  4. Choose a sink connector/dialect whose precision limit matches the source

Example fix

// before
DECIMAL(38, 10)
// after (DB2-compatible)
DECIMAL(31, 3)
Defensive patterns

Strategy: validation

Validate before calling

// before write
DecimalType dt = (DecimalType) column.getDataType();
if (dt.getPrecision() > 31) {
    // pre-cast/downscale: decimal(31, max(0, scale - (precision-31)))
    throw new IllegalArgumentException("Precision " + dt.getPrecision() + " exceeds DB2 max 31 for column " + column.getName());
}

Type guard

boolean fitsDb2Decimal(DecimalType dt) {
    return dt.getPrecision() > 0 && dt.getPrecision() <= 31;
}

Prevention

When it happens

Trigger: reconvert receives a column with e.g. decimal(38,10) — common from sources like MySQL DECIMAL(65,x) or user schemas with precision > 31.

Common situations: Syncing MySQL/Postgres NUMERIC(38+) columns into DB2; aggregations upstream that widen decimals; schema evolution carrying large precisions from source DDL.

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