apache/seatunnel · warning
The length of clob type
Error message
The length of clob type {} is out of range, it will be converted to {}({}) What it means
When converting a string/CLOB-typed column back to DB2 DDL, if the declared length exceeds DB2's maximum CLOB size (MAX_CLOB_LENGTH = 2147483647 characters), the converter clamps it to the maximum and logs this warning, emitting CLOB(max). Otherwise DB2 DDL creation would fail with an oversized length.
Solutions
- Cap the string column length to <= 2147483647 in the source schema
- Accept the clamped CLOB(2147483647) and confirm data fits within the limit
- If the text actually fits in VARCHAR, map to a VARCHAR(<=32672) to avoid CLOB overhead
- Store oversized documents externally and sync only references
Example fix
// before (source schema) StringType(length = 4294967295) // after (clamped to DB2 max) StringType(length = 2147483647) // CLOB(2147483647)
Defensive patterns
Strategy: validation
Validate before calling
// before write
long len = column.getColumnLength();
if (len > 2147483647L) {
throw new IllegalArgumentException("CLOB length " + len + " exceeds DB2 max 2147483647 for column " + column.getName());
} Type guard
boolean fitsDb2Clob(long length) {
return length <= 2147483647L;
} Prevention
- Cap text column lengths at 2GB-1 for DB2 sinks
- Use VARCHAR(<=32672) when content is small to avoid CLOB overhead
- Avoid Long.MAX_VALUE as a stand-in for unknown string length
When it happens
Trigger: reconvert processes a StringType column whose getColumnLength() is greater than 2147483647, e.g. sources reporting LONGTEXT with 4GB lengths or unknown lengths mapped to Long.MAX_VALUE.
Common situations: Syncing MySQL LONGTEXT into DB2; connectors defaulting unknown string lengths to max long; schema definitions with huge hand-set lengths.
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/62dff8f8ee798360.
Report an issue: GitHub.
Appendix: source
Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/db2/DB2TypeConverter.java:373
case STRING:
if (column.getColumnLength() == null || column.getColumnLength() <= 0) {
builder.columnType(String.format("%s(%s)", DB2_VARCHAR, MAX_VARCHAR_LENGTH));
builder.dataType(DB2_VARCHAR);
builder.length(column.getColumnLength());
} else if (column.getColumnLength() <= MAX_CHAR_LENGTH) {
builder.columnType(String.format("%s(%s)", DB2_CHAR, column.getColumnLength()));
builder.dataType(DB2_CHAR);
builder.length(column.getColumnLength());
} else if (column.getColumnLength() <= MAX_VARCHAR_LENGTH) {
builder.columnType(
String.format("%s(%s)", DB2_VARCHAR, column.getColumnLength()));
builder.dataType(DB2_VARCHAR);
builder.length(column.getColumnLength());
} else {
long length = column.getColumnLength();
if (length > MAX_CLOB_LENGTH) {
length = MAX_CLOB_LENGTH;
log.warn(
"The length of clob type {} is out of range, "
+ "it will be converted to {}({})",
column.getName(),
DB2_CLOB,
length);
}
builder.columnType(String.format("%s(%s)", DB2_CLOB, length));
builder.dataType(DB2_CLOB);
builder.length(length);
}
break;
case DATE:
builder.columnType(DB2_DATE);
builder.dataType(DB2_DATE);
break;
case TIME:
builder.columnType(DB2_TIME);
builder.dataType(DB2_TIME);View on GitHub (pinned to cf67b549a7)