apache/seatunnel · warning

The length of blob type

Error message

The length of blob type {} is out of range, it will be converted to {}({})

What it means

When converting a binary/BLOB-typed column back to DB2 DDL, if the declared length exceeds DB2's maximum BLOB size (MAX_BLOB_LENGTH = 2147483647 bytes, 2GB-1), the converter clamps it to the maximum and logs this warning, emitting BLOB(max). DB2 cannot create a BLOB larger than its limit, so the oversized length is silently reduced.

Solutions

  1. Cap the column length in the source/schema to <= 2147483647 bytes
  2. Accept the clamped BLOB(2147483647) and verify no rows will exceed 2GB-1
  3. Use a transform or upstream filtering to exclude rows larger than the DB2 BLOB limit
  4. If larger objects are required, store them externally (object storage) and keep references in the table

Example fix

// before (source schema)
BytesType(length = 4294967295)
// after (clamped to DB2 max)
BytesType(length = 2147483647) // BLOB(2147483647)
Defensive patterns

Strategy: validation

Validate before calling

// before write
long len = column.getColumnLength();
if (len > 2147483647L) {
    throw new IllegalArgumentException("BLOB length " + len + " exceeds DB2 max 2147483647 for column " + column.getName());
}

Type guard

boolean fitsDb2Blob(long length) {
    return length <= 2147483647L;
}

Prevention

When it happens

Trigger: reconvert processes a BytesType/binary column whose getColumnLength() is greater than 2147483647, e.g. from sources declaring LONGTEXT/BLOB sizes as Long.MAX_VALUE or 4GB+ lengths.

Common situations: Syncing MySQL LONGBLOB (interpreted as ~4GB) into DB2; connectors that report unknown length as Long.MAX_VALUE; schema files with hand-entered giant 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/d1e02eea65915540. 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:343

                    builder.columnType(
                            String.format("%s(%s)", DB2_VARBINARY, MAX_VARBINARY_LENGTH));
                    builder.dataType(DB2_VARBINARY);
                    builder.length(column.getColumnLength());
                } else if (column.getColumnLength() <= MAX_BINARY_LENGTH) {
                    builder.columnType(
                            String.format("%s(%s)", DB2_BINARY, column.getColumnLength()));
                    builder.dataType(DB2_BINARY);
                    builder.length(column.getColumnLength());
                } else if (column.getColumnLength() <= MAX_VARBINARY_LENGTH) {
                    builder.columnType(
                            String.format("%s(%s)", DB2_VARBINARY, column.getColumnLength()));
                    builder.dataType(DB2_VARBINARY);
                    builder.length(column.getColumnLength());
                } else {
                    long length = column.getColumnLength();
                    if (length > MAX_BLOB_LENGTH) {
                        length = MAX_BLOB_LENGTH;
                        log.warn(
                                "The length of blob type {} is out of range, "
                                        + "it will be converted to {}({})",
                                column.getName(),
                                DB2_BLOB,
                                length);
                    }
                    builder.columnType(String.format("%s(%s)", DB2_BLOB, length));
                    builder.dataType(DB2_BLOB);
                    builder.length(length);
                }
                break;
            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()));

View on GitHub (pinned to cf67b549a7)