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 scale less than 0, it will be converted to decimal({},{}) What it means
Decimal scale in DB2 must be >= 0. If reconvert encounters a DecimalType with negative scale (or a scale left negative after precision clamping), it sets scale to 0 and logs this warning, converting the type to decimal(p,0). Negative scale is not representable in DB2 DECIMAL.
Source
Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/db2/DB2TypeConverter.java:295
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)
Solutions
- Change the column to non-negative scale at the source or via a transform cast (e.g. ROUND to integer scale 0)
- Explicitly define the sink schema with scale 0 for that column
- If coming from precision clamping, reduce source precision so scale stays non-negative
- Verify the source dialect's type mapper isn't emitting negative scales erroneously
Example fix
// before DECIMAL(10, -2) // after DECIMAL(10, 0)
Defensive patterns
Strategy: validation
Validate before calling
// before write
DecimalType dt = (DecimalType) column.getDataType();
if (dt.getScale() < 0) {
throw new IllegalArgumentException("Column " + column.getName() + " has negative decimal scale " + dt.getScale());
} Type guard
boolean hasNonNegativeScale(DecimalType dt) {
return dt.getScale() >= 0;
} Prevention
- Convert Oracle-style negative scales (NUMBER(p,-s)) before syncing to DB2
- After precision clamping, re-check scale >= 0 in your schema validation
- Round to scale 0 explicitly when integer representation is intended
When it happens
Trigger: reconvert gets a column with scale < 0, e.g. from sources that model DECIMAL(p,-s) (Oracle-style negative scale) or as a side effect of the precision-shrink formula scale - (precision - MAX_PRECISION).
Common situations: Migrating from Oracle where NUMBER(p,-2) style negative scale exists; precision clamping of very wide decimals pushing scale negative; programmatic schemas 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
- 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/d25adcf7de24bae3.
Report an issue: GitHub.