apache/seatunnel · warning
DECIMAL precision {} exceeds maximum {}, truncating to {}
Error message
DECIMAL precision {} exceeds maximum {}, truncating to {} What it means
Warning from DuckDBTypeConverter.handleDecimalType (via convert): the source DECIMAL's precision exceeds MAX_PRECISION supported by the DuckDB dialect, so precision is truncated to MAX_PRECISION. The converted column will declare the reduced precision, which can cause rounding or write failures if actual values need more digits.
Source
Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/duckdb/DuckDBTypeConverter.java:200
builder.dataType(BasicType.STRING_TYPE);
builder.columnLength(lengthValue > 0 ? lengthValue : 65535);
break;
default:
log.warn("Unsupported DuckDB type: {}, falling back to STRING", duckDBType);
builder.dataType(BasicType.STRING_TYPE);
builder.columnLength(lengthValue > 0 ? lengthValue : 255);
}
return builder.build();
}
private void handleDecimalType(
PhysicalColumn.PhysicalColumnBuilder builder, BasicTypeDefine typeDefine) {
long precision =
typeDefine.getPrecision() != null ? typeDefine.getPrecision() : DEFAULT_PRECISION;
int scale = typeDefine.getScale() != null ? typeDefine.getScale() : DEFAULT_SCALE;
if (precision > MAX_PRECISION) {
log.warn(
"DECIMAL precision {} exceeds maximum {}, truncating to {}",
precision,
MAX_PRECISION,
MAX_PRECISION);
precision = MAX_PRECISION;
}
if (scale < 0) {
log.warn("DECIMAL scale {} is negative, setting to 0", scale);
scale = 0;
} else if (scale > MAX_SCALE) {
log.warn(
"DECIMAL scale {} exceeds maximum {}, truncating to {}",
scale,
MAX_SCALE,
MAX_SCALE);
scale = MAX_SCALE;
}
View on GitHub (pinned to cf67b549a7)
Solutions
- Cast the source column to a precision within the dialect maximum, e.g. CAST(col AS DECIMAL(38,6)).
- Raise the sink column definition manually if you control schema creation.
- Verify actual data range; if values never approach the max, the truncation is harmless.
- Upgrade the connector if a newer version supports higher precision.
Example fix
// before SELECT amount FROM ledger; -- DECIMAL(45,10) // after SELECT CAST(amount AS DECIMAL(38,10)) AS amount FROM ledger;
Defensive patterns
Strategy: validation
Validate before calling
for (Column c : columns) {
if (c.getDataType() instanceof DecimalType) {
long p = ((DecimalType) c.getDataType()).getPrecision();
if (p > MAX_PRECISION) throw new IllegalArgumentException(
"Column " + c.getName() + " precision " + p + " exceeds " + MAX_PRECISION);
}
} Type guard
boolean isDuckDbSafeDecimal(DecimalType t) {
return t.getPrecision() > 0 && t.getPrecision() <= MAX_PRECISION;
} Prevention
- CAST oversized decimals at the source query to the dialect max precision.
- Audit source schemas for DECIMAL with precision > 38 before cross-engine syncs.
- Pre-create sink tables with intentional precision instead of auto mapping.
When it happens
Trigger: Calling convert on a BasicTypeDefine with getPrecision() > the dialect's MAX_PRECISION (e.g. DECIMAL(40,10) from a source table).
Common situations: Syncing DECIMAL columns from engines that allow larger precision (e.g. some sources allow up to 38+ or unbounded) into DuckDB via catalog-driven schema mapping.
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
- DECIMAL scale {} is negative, setting to 0
- DECIMAL scale {} exceeds maximum {}, truncating to {}
- The decimal column {} type decimal({},{}) is out of range, w
- The decimal column {} type decimal({},{}) is out of range, w
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/902dd984ab6fa888.
Report an issue: GitHub.