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

What it means

If a decimal column's scale exceeds Phoenix's supported MAX_SCALE during reconvert, the converter logs this warning and clamps the scale to MAX_SCALE while keeping (or already-clamped) precision. Extra fractional digits beyond MAX_SCALE are lost, introducing rounding when data is written to Phoenix.

Source

Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/phoenix/PhoenixTypeConverter.java:248

                            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)", PHOENIX_DECIMAL, precision, scale));
                builder.dataType(PHOENIX_DECIMAL);
                builder.precision(precision);
                builder.scale(scale);
                break;
            case BYTES:
                builder.columnType(PHOENIX_BINARY);

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Reduce the source decimal scale to fit within MAX_SCALE in the catalog schema.
  2. Round the column upstream (e.g. ROUND(col, maxScale) or CAST to a smaller decimal) before the Phoenix sink.
  3. Verify from the warning that truncation to decimal(precision, MAX_SCALE) is acceptable for your use case.
  4. Pick a sink that supports the required scale if the extra fractional digits are mandatory.

Example fix

// before
new DecimalType(10, 20); // scale exceeds MAX_SCALE
// after
new DecimalType(10, 6); // within MAX_SCALE
Defensive patterns

Strategy: validation

Validate before calling

DecimalType dt = (DecimalType) col.getDataType();
if (dt.getScale() > phoenixMaxScale) {
    col = CatalogColumn.of(col.getName(), new DecimalType(dt.getPrecision(), phoenixMaxScale), col.isNullable(), col.getDefaultValue());
}

Type guard

boolean fitsPhoenixScale(CatalogColumn c) {
    return c.getDataType() instanceof DecimalType
        && ((DecimalType) c.getDataType()).getScale() <= 6; // Phoenix max scale
}

Prevention

When it happens

Trigger: PhoenixTypeConverter.reconvert() on a DecimalType with scale > MAX_SCALE (e.g. DECIMAL(10,20) where scale exceeds Phoenix's max fractional digits).

Common situations: Sources declaring high-scale decimals (scientific/financial data) written to Phoenix; schema inference returning oversized scales.

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