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

What it means

SqlServerTypeConverter.reconvert found a DECIMAL column whose precision is <= 0, which SQL Server cannot represent. It clamps to the default precision/scale and logs a warning; data conversion continues with the adjusted type.

Solutions

  1. Fix the upstream schema so the DECIMAL column carries a positive precision.
  2. Explicitly declare the column type in your source config, e.g. decimal(38,10).
  3. If the source default is fine, accept the warning — the column becomes DEFAULT_PRECISION/DEFAULT_SCALE.

Example fix

// before
schema = { field = "amount", type = "decimal(0,2)" }
// after
schema = { field = "amount", type = "decimal(18,2)" }
Defensive patterns

Strategy: validation

Validate before calling

// Validate decimal precision before writing:
if (dt.getPrecision() <= 0) throw new IllegalArgumentException("decimal precision must be > 0 for column " + col.getName());

Type guard

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

Prevention

When it happens

Trigger: A pipeline column of DecimalType with precision 0 or negative (usually from an upstream parser producing decimal(0,s) or unset precision) is converted into a SQL Server type via reconvert.

Common situations: Source connectors emitting DecimalType with precision unset/0; SeaTunnel config or schema inference bugs producing decimal(0); deserialized schemas losing precision metadata.

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/64d43bc5cb78ab99. 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:354

                builder.columnType(SQLSERVER_BIGINT);
                builder.dataType(SQLSERVER_BIGINT);
                break;
            case FLOAT:
                builder.columnType(SQLSERVER_REAL);
                builder.dataType(SQLSERVER_REAL);
                break;
            case DOUBLE:
                builder.columnType(SQLSERVER_FLOAT);
                builder.dataType(SQLSERVER_FLOAT);
                break;
            case DECIMAL:
                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(),

View on GitHub (pinned to cf67b549a7)