apache/seatunnel · error · UnsupportedOperationException

Cannot convert field %s from type %s to %s of Paimon table %

Error message

Cannot convert field %s from type %s to %s of Paimon table %s.

What it means

When a column type-change event cannot be converted (converter resolution EXCEPTION mode), updateColumn throws UnsupportedOperationException stating the field, old type, new type and Paimon table. Paimon requires explicit compatible type conversion rules; an impossible or unsafe conversion is refused rather than silently corrupting the table.

Source

Thrown at seatunnel-connectors-v2/connector-paimon/src/main/java/org/apache/seatunnel/connectors/seatunnel/paimon/sink/schema/handler/AlterPaimonTableSchemaEventHandler.java:183

        DataField dataField = sinkPaimonTableSchema.fields().get(idx);
        DataType oldDataType = dataField.type();
        switch (canConvert(oldDataType, newDataType)) {
            case CONVERT:
                paimonCatalog.alterTable(
                        identifier,
                        SchemaChange.updateColumnType(oldColumnName, newDataType),
                        false);
                break;
            case IGNORE:
                log.warn(
                        "old: {{}-{}} and new: {{}-{}} belongs to the same type family, but old type has higher precision than new type. Ignore this convert request.",
                        dataField.name(),
                        oldDataType,
                        reconvertColumn.getName(),
                        newDataType);
                break;
            case EXCEPTION:
                throw new UnsupportedOperationException(
                        String.format(
                                "Cannot convert field %s from type %s to %s of Paimon table %s.",
                                oldColumnName, oldDataType, newDataType, identifier.getFullName()));
        }
        if (StringUtils.isNotBlank(afterTheColumn)) {
            paimonCatalog.alterTable(
                    identifier,
                    SchemaChange.updateColumnPosition(
                            SchemaChange.Move.after(oldColumnName, afterTheColumn)),
                    false);
        }
        String comment = newColumn.getComment();
        if (StringUtils.isNotBlank(comment)) {
            paimonCatalog.alterTable(
                    identifier, SchemaChange.updateColumnComment(oldColumnName, comment), false);
        }
        paimonCatalog.alterTable(
                identifier,

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Check whether the old-to-new type conversion is valid for Paimon (e.g. widen only: INT->BIGINT, FLOAT->DOUBLE)
  2. Perform the type change manually in Paimon (ALTER TABLE ... ALTER COLUMN ... TYPE) or recreate the table/rewrite data
  3. Configure the type conversion mode (e.g. EXCEPTION -> a permissive/legacy mode) if your deployment allows lossy conversion
  4. Align upstream schema-change events so column types only change compatibly

Example fix

// before
-- event: ALTER COLUMN age STRING (from INT)
// after
-- use compatible widening instead
ALTER TABLE t ALTER COLUMN age BIGINT;
Defensive patterns

Strategy: validation

Validate before calling

boolean isCompatibleTypeChange(DataType old, DataType desired) { Set<String> allowed = Set.of("INT->BIGINT","FLOAT->DOUBLE","STRING->STRING","TINYINT->INT"); return old.equals(desired) || allowed.contains(old + "->" + desired); }

Try / catch

try { handler.apply(columnTypeEvent); } catch (UnsupportedOperationException e) { log.error("Incompatible type conversion on {}: {}", tablePath, e.getMessage()); /* fall back to manual migration */ }

Prevention

When it happens

Trigger: An AlterColumnTypeEvent is applied to a Paimon table where the old SeaTunnel data type cannot be reconverted/mapped to the requested new Paimon type — typeConvertResolver returns EXCEPTION, e.g. INT -> ARRAY, STRING -> INT with data present, or unmapped custom types.

Common situations: Upstream schema changed a column to an incompatible type; automatic type inference picked a narrower type; connector version mapping tables differ between old/new data types for the same logical column.

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/efe67f61dd8953ed. Report an issue: GitHub.