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

DB2TypeConverter.reconvert converts a SeaTunnel DecimalType back to a DB2-compatible definition. DB2 requires a positive decimal precision; if the column's precision is <= 0, the converter logs this warning and replaces the type with DEFAULT_PRECISION/DEFAULT_SCALE (decimal(5,0)). The pipeline continues with the substituted type.

Source

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

                builder.columnType(DB2_BIGINT);
                builder.dataType(DB2_BIGINT);
                break;
            case FLOAT:
                builder.columnType(DB2_REAL);
                builder.dataType(DB2_REAL);
                break;
            case DOUBLE:
                builder.columnType(DB2_DOUBLE);
                builder.dataType(DB2_DOUBLE);
                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)

Solutions

  1. Fix the upstream schema so the decimal column carries a real precision (e.g. DECIMAL(10,2))
  2. Check the source connector's type mapping if it reports precision 0 from database metadata
  3. If authoring schemas manually, use precision >= 1 and scale <= precision
  4. Upgrade/patch the source connector if its metadata parsing is known to emit 0 precision

Example fix

// before (schema)
DecimalType(0, 0)
// after
DecimalType(10, 2)
Defensive patterns

Strategy: validation

Validate before calling

// before write
DecimalType dt = (DecimalType) column.getDataType();
if (dt.getPrecision() <= 0) {
    throw new IllegalArgumentException("Column " + column.getName() + " has invalid decimal precision " + dt.getPrecision());
}

Type guard

boolean isValidDecimal(ColumnType col) {
    return col.getDataType() instanceof DecimalType
        && ((DecimalType) col.getDataType()).getPrecision() > 0;
}

Prevention

When it happens

Trigger: reconvert encounters a column whose DecimalType has precision <= 0, e.g. decimal(0,0) produced by an upstream mapping bug, a manually authored schema, or a source connector emitting a degenerate decimal.

Common situations: Hand-written SeaTunnel schema files with decimal(0); source connectors that report precision 0 when metadata is unavailable; programmatic schema construction passing 0/-1 precision.

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