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

What it means

WARN logged by SqlServerTypeConverter.reconvert when a DECIMAL column has a negative scale; the scale is clamped to zero and the adjusted decimal(precision,scale) is emitted in the SQL Server DDL. Type-adjustment warning only.

Solutions

  1. Set the column scale to >= 0 in the schema (e.g. decimal(18,0)).
  2. If negative-scale semantics (rounding to hundreds/thousands) matter, pre-round the values in a transform and use scale 0.
  3. Ignore the warning if scale 0 output is acceptable.

Example fix

// before
field = { name = "qty", type = "decimal(10,-2)" }
// after
field = { name = "qty", type = "decimal(10,0)" }
Defensive patterns

Strategy: validation

Validate before calling

if (dt.getScale() < 0) throw new IllegalArgumentException("decimal scale must be >= 0 for column " + col.getName());

Type guard

boolean hasNonNegativeScale(DecimalType dt) { return dt.getScale() >= 0; }

Prevention

When it happens

Trigger: reconvert encounters DecimalType with scale < 0 — possible when upstream type inference or config yields negative scale (some engines allow negative scale, e.g. Oracle NUMBER(p,-s)).

Common situations: Migrating from Oracle NUMBER with negative scale, or schemas constructed programmatically with negative scale values.

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

Appendix: source

Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/sqlserver/SqlServerTypeConverter.java:379

                            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(),
                            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,

View on GitHub (pinned to cf67b549a7)