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 is precision less than 0, it will be converted to decimal({},{})

What it means

During schema re-conversion to StarRocks types, a decimal column whose precision is <= 0 is invalid. The connector logs this warning and silently coerces the type to decimal(MAX_PRECISION, MAX_SCALE) instead of failing.

Source

Thrown at seatunnel-connectors-v2/connector-starrocks/src/main/java/org/apache/seatunnel/connectors/seatunnel/starrocks/datatypes/StarRocksTypeConverter.java:241

            case DOUBLE:
                builder.columnType(SR_DOUBLE);
                builder.dataType(SR_DOUBLE);
                break;
            case DECIMAL:
                // DORIS LARGEINT
                if (column.getSourceType() != null
                        && column.getSourceType().equalsIgnoreCase(SR_LARGEINT)) {
                    builder.dataType(SR_LARGEINT);
                    builder.columnType(SR_LARGEINT);
                    break;
                }
                DecimalType decimalType = (DecimalType) column.getDataType();
                int precision = decimalType.getPrecision();
                int scale = decimalType.getScale();
                if (precision <= 0) {
                    precision = MAX_PRECISION.intValue();
                    scale = MAX_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) {
                    log.warn(
                            "The decimal column {} type decimal({},{}) is out of range, "
                                    + "which exceeds the maximum precision of {}, "
                                    + "it will be converted to varchar(200)",
                            column.getName(),
                            decimalType.getPrecision(),
                            decimalType.getScale(),
                            MAX_PRECISION);
                    builder.dataType(SR_VARCHAR);

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Inspect the source table schema and fix the column to a valid decimal(p,s) with precision >= 1
  2. Explicitly define the sink schema with a correct decimal precision instead of relying on auto-conversion
  3. If intentional, accept the widened decimal(38, 9)-style default and verify values still fit
Defensive patterns

Strategy: validation

Validate before calling

if (dt instanceof DecimalType) {
  DecimalType d = (DecimalType) dt;
  if (d.getPrecision() <= 0) throw new IllegalArgumentException(
    "Column " + col.getName() + " has invalid decimal precision " + d.getPrecision());
}

Type guard

boolean hasValidDecimal(Column c) {
  return !(c.getDataType() instanceof DecimalType)
      || ((DecimalType) c.getDataType()).getPrecision() > 0;
}

Prevention

When it happens

Trigger: reconvert() (via keyColumnType/valueColumnType) receives a CatalogTable column whose DecimalType has precision <= 0.

Common situations: Upstream metadata returning uninitialized/placeholder decimal precision; programmatic schema construction with unset precision; source systems reporting decimals with precision 0.

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