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
DB2 limits decimal scale to MAX_PRECISION - 1 = 30. When reconvert sees a scale greater than 30, it clamps scale to 30 and logs this warning, converting to decimal(p,30). Digits beyond the retained scale will be truncated/rounded on write.
Source
Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/db2/DB2TypeConverter.java:306
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)", DB2_DECIMAL, precision, scale));
builder.dataType(DB2_DECIMAL);
builder.precision(precision);
builder.scale(scale);
break;
case BYTES:
if (column.getColumnLength() == null || column.getColumnLength() <= 0) {View on GitHub (pinned to cf67b549a7)
Solutions
- Reduce the source scale to <= 30 (e.g. DECIMAL(38,30)) or use a transform to round the values
- Define an explicit sink schema for the column with an acceptable scale
- Accept the clamped decimal(p,30) after verifying downstream precision tolerance
- Consider a sink that supports larger scales if exact precision is required
Example fix
// before NUMERIC(38, 38) // after (DB2-compatible) NUMERIC(38, 30)
Defensive patterns
Strategy: validation
Validate before calling
// before write
DecimalType dt = (DecimalType) column.getDataType();
if (dt.getScale() > 30) {
throw new IllegalArgumentException("Scale " + dt.getScale() + " exceeds DB2 max 30 for column " + column.getName());
} Type guard
boolean fitsDb2Scale(DecimalType dt) {
return dt.getScale() <= 30;
} Prevention
- Keep decimal scale <= 30 when targeting DB2
- Avoid scale == precision schemas for high-precision financial data
- Round values in a transform to control truncation semantics
- Validate sink limits against source DDL during pipeline design
When it happens
Trigger: reconvert receives a column like decimal(38,38) or decimal(20,35), where scale exceeds 30 — typical of high-precision financial sources or NUMERIC with scale == precision.
Common situations: Syncing high-scale financial columns (e.g. Postgres NUMERIC(38,38)) into DB2; source schemas auto-generated with scale equal to precision; schema evolution importing very precise columns.
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
- The decimal column {} type decimal({},{}) is out of range, w
- The decimal column {} type decimal({},{}) is out of range, w
- The decimal column {} type decimal({},{}) is out of range, w
- The decimal column {} type decimal({},{}) is out of range, w
- DECIMAL scale {} is negative, setting to 0
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/df9d16e98263ea30.
Report an issue: GitHub.