apache/seatunnel · error · UnsupportedOperationException

Unsupported alter table event:

Error message

Unsupported alter table event: 

What it means

applySchemaChange handles schema-change events by dispatching AlterTableColumnsEvent and AlterTableColumnEvent; any other event kind is unsupported and throws UnsupportedOperationException('Unsupported alter table event: ' + event).

Source

Thrown at seatunnel-connectors-v2/connector-elasticsearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/sink/ElasticsearchSinkWriter.java:196

        String indexRequestRow = seaTunnelRowSerializer.serializeRow(element);
        requestEsList.add(indexRequestRow);
        if (requestEsList.size() >= maxBatchSize) {
            bulkEsWithRetry(this.esRestClient, this.requestEsList);
        }
    }

    @Override
    public void applySchemaChange(SchemaChangeEvent event) throws IOException {
        if (isCommentOnlyEvent(event)) {
            log.debug("Ignore comment-only schema change event: {}", event);
        } else if (event instanceof AlterTableColumnsEvent) {
            for (AlterTableColumnEvent columnEvent : ((AlterTableColumnsEvent) event).getEvents()) {
                applySingleSchemaChangeEvent(columnEvent);
            }
        } else if (event instanceof AlterTableColumnEvent) {
            applySingleSchemaChangeEvent(event);
        } else {
            throw new UnsupportedOperationException("Unsupported alter table event: " + event);
        }

        this.tableSchema = tableSchemaChangeEventHandler.reset(tableSchema).apply(event);

        initializeSerializer(tableSchema.toPhysicalRowDataType());
    }

    static boolean isCommentOnlyEvent(SchemaChangeEvent event) {
        return event instanceof AlterTableCommentEvent || event instanceof AlterColumnCommentEvent;
    }

    private void applySingleSchemaChangeEvent(SchemaChangeEvent event) {
        if (isCommentOnlyEvent(event)) {
            log.debug("Ignore comment-only schema change event: {}", event);
        } else if (event instanceof AlterTableAddColumnEvent) {
            AlterTableAddColumnEvent addColumnEvent = (AlterTableAddColumnEvent) event;
            Column column = addColumnEvent.getColumn();
            BasicTypeDefine<EsType> reconvert =

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Restrict upstream DDL to ADD COLUMN operations, or filter unsupported events before the sink
  2. Handle the event manually by applying equivalent changes to the ES index
  3. Check connector docs/versions for broader schema-change support
Defensive patterns

Strategy: type-guard

Validate before calling

if (!(event instanceof AlterTableColumnsEvent) && !(event instanceof AlterTableColumnEvent)) {
    log.warn("Skipping unsupported schema event: " + event.getClass().getSimpleName());
    return;
}

Type guard

boolean isSupportedSchemaEvent(AlterTableEvent e) {
    return e instanceof AlterTableColumnsEvent || e instanceof AlterTableColumnEvent;
}

Prevention

When it happens

Trigger: The schema-change provider delivers an AlterTableEvent type other than column add/columns change (e.g. rename table, drop table, truncate) to the ES sink's applySchemaChange.

Common situations: CDC pipelines (MySQL/Postgres -> ES) where upstream DDL includes operations the ES connector does not support, such as table renames or drops.

Related errors


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