apache/seatunnel · error · UnsupportedOperationException

Unsupported alter table event:

Error message

Unsupported alter table event: 

What it means

Thrown by AlterTableEventHandler.apply when a SchemaChangeEvent is not one of the supported event types (add/rename/modify/drop column, AlterTableColumnsEvent, etc.). The handler cannot translate the event into row-type changes, so it refuses with UnsupportedOperationException naming the event.

Source

Thrown at seatunnel-api/src/main/java/org/apache/seatunnel/api/table/schema/handler/AlterTableEventHandler.java:89

        if (alterTableEvent instanceof AlterTableModifyColumnEvent) {
            return applyModifyColumn(dataType, (AlterTableModifyColumnEvent) alterTableEvent);
        }
        if (alterTableEvent instanceof AlterTableChangeColumnEvent) {
            return applyChangeColumn(dataType, (AlterTableChangeColumnEvent) alterTableEvent);
        }
        if (alterTableEvent instanceof AlterTableAddColumnEvent) {
            return applyAddColumn(dataType, (AlterTableAddColumnEvent) alterTableEvent);
        }
        if (alterTableEvent instanceof AlterTableColumnsEvent) {
            SeaTunnelRowType newType = dataType;
            for (AlterTableColumnEvent columnEvent :
                    ((AlterTableColumnsEvent) alterTableEvent).getEvents()) {
                newType = apply(newType, columnEvent);
            }
            return newType;
        }

        throw new UnsupportedOperationException(
                "Unsupported alter table event: " + alterTableEvent);
    }

    private SeaTunnelRowType applyAddColumn(
            SeaTunnelRowType dataType, AlterTableAddColumnEvent addColumnEvent) {
        LinkedList<String> originFields = new LinkedList<>(Arrays.asList(dataType.getFieldNames()));
        LinkedList<SeaTunnelDataType<?>> originFieldTypes =
                new LinkedList<>(Arrays.asList(dataType.getFieldTypes()));
        Column column = addColumnEvent.getColumn();
        if (originFields.contains(column.getName())) {
            return applyModifyColumn(
                    dataType,
                    new AlterTableModifyColumnEvent(
                            addColumnEvent.tableIdentifier(),
                            addColumnEvent.getColumn(),
                            addColumnEvent.isFirst(),
                            addColumnEvent.getAfterColumn()));
        }

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Upgrade SeaTunnel to a version whose AlterTableEventHandler supports the event type.
  2. Route the event to the correct handler (e.g. AlterTableSchemaEventHandler for schema-level events like column comments).
  3. Filter or degrade unsupported schema-change events in the connector before applying them to the row type.
  4. Extend the handler (subclass/override apply) if you own a custom event type.

Example fix

// before
SeaTunnelRowType newType = AlterTableEventHandler.apply(rowType, commentEvent); // unsupported
// after
TableSchema schema = AlterTableSchemaEventHandler.apply(tableSchema, commentEvent);
Defensive patterns

Strategy: try-catch

Validate before calling

if (!(event instanceof AlterTableAddColumnEvent || event instanceof AlterTableColumnsEvent || event instanceof AlterTableRenameColumnEvent || event instanceof AlterTableModifyColumnEvent || event instanceof AlterTableDropColumnEvent)) { log.warn("unsupported event {}", event); return dataType; }

Type guard

boolean supported = event instanceof AlterTableColumnEvent || event instanceof AlterTableColumnsEvent;

Try / catch

try { return AlterTableEventHandler.apply(rowType, event); } catch (UnsupportedOperationException e) { log.warn("skipping unsupported alter event: {}", e.getMessage()); return rowType; }

Prevention

When it happens

Trigger: Passing a SchemaChangeEvent subclass not covered by the instanceof chain in apply (e.g. a new/custom event type or schema-change event like AlterColumnCommentEvent handled elsewhere) to AlterTableEventHandler.apply.

Common situations: CDC pipelines where the upstream database emits a DDL event type the SeaTunnel version does not yet support; forwarding raw schema-change events from connectors into the row-type handler; mixing handler implementations (row-type vs TableSchema) with unsupported event types.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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