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
When mapping a decimal column back to Phoenix, a negative scale is not representable, so the converter logs this warning and sets the scale to 0 (after the precision fixes above). The resulting Phoenix column is a plain integer-scaled decimal; fractional data may be rounded on write.
Source
Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/phoenix/PhoenixTypeConverter.java:237
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
- Ensure the source decimal has a non-negative scale in the catalog schema.
- Explicitly round/transform the column to scale >= 0 upstream (e.g. CAST(col AS DECIMAL(10,0))).
- Inspect the warning to identify the column and verify scale 0 is acceptable for your data.
- If precision clamping caused this, start with a smaller, valid precision so scale is never decremented below 0.
Example fix
// before new DecimalType(10, -3); // after new DecimalType(10, 0); // round value upstream first
Defensive patterns
Strategy: validation
Validate before calling
DecimalType dt = (DecimalType) col.getDataType();
if (dt.getScale() < 0) {
col = CatalogColumn.of(col.getName(), new DecimalType(dt.getPrecision(), 0), col.isNullable(), col.getDefaultValue());
} Type guard
boolean hasNonNegativeScale(CatalogColumn c) {
return c.getDataType() instanceof DecimalType
&& ((DecimalType) c.getDataType()).getScale() >= 0;
} Prevention
- Round values upstream before the sink when using negative-scale semantics
- Keep source decimal scales non-negative in catalog schemas
- Audit cross-engine schemas (Spark/Flink) for negative-scale decimals
When it happens
Trigger: PhoenixTypeConverter.reconvert() on a DecimalType whose scale is negative (e.g. DecimalType(10,-3) as produced by some systems to mean thousands rounding), or a scale driven negative by the precision-clamping branch when precision was drastically reduced.
Common situations: Cross-engine schema exchange (Spark/Flink-style negative-scale decimals) feeding a Phoenix sink; heavily reduced precision columns where scale was decremented below 0.
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 time column {} type time({}) is out of range, which exce
- The timestamp column {} type timestamp({}) is out of range,
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/a8fe63f54a19116a.
Report an issue: GitHub.