apache/iceberg · error · UnsupportedOperationException

Unsupported table change: AddWatermark.

Error message

Unsupported table change: AddWatermark.

What it means

FlinkAlterTableUtil.applySchemaChanges translates Flink TableChange objects into Iceberg UpdateSchema operations. Watermark changes have no Iceberg schema representation, so AddWatermark is explicitly rejected with UnsupportedOperationException.

Source

Thrown at flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/util/FlinkAlterTableUtil.java:135

  /**
   * Applies a list of Flink table changes to an {@link UpdateSchema} operation.
   *
   * @param pendingUpdate an uncommitted UpdateSchema operation to configure
   * @param schemaChanges a list of Flink table changes
   */
  public static void applySchemaChanges(
      UpdateSchema pendingUpdate, List<TableChange> schemaChanges) {
    for (TableChange change : schemaChanges) {
      if (change instanceof TableChange.AddColumn) {
        applyAddColumn(pendingUpdate, (TableChange.AddColumn) change);
      } else if (change instanceof TableChange.ModifyColumn) {
        TableChange.ModifyColumn modifyColumn = (TableChange.ModifyColumn) change;
        applyModifyColumn(pendingUpdate, modifyColumn);
      } else if (change instanceof TableChange.DropColumn) {
        TableChange.DropColumn dropColumn = (TableChange.DropColumn) change;
        pendingUpdate.deleteColumn(dropColumn.getColumnName());
      } else if (change instanceof TableChange.AddWatermark) {
        throw new UnsupportedOperationException("Unsupported table change: AddWatermark.");
      } else if (change instanceof TableChange.ModifyWatermark) {
        throw new UnsupportedOperationException("Unsupported table change: ModifyWatermark.");
      } else if (change instanceof TableChange.DropWatermark) {
        throw new UnsupportedOperationException("Unsupported table change: DropWatermark.");
      } else if (change instanceof TableChange.AddUniqueConstraint) {
        TableChange.AddUniqueConstraint addPk = (TableChange.AddUniqueConstraint) change;
        applyUniqueConstraint(pendingUpdate, addPk.getConstraint());
      } else if (change instanceof TableChange.ModifyUniqueConstraint) {
        TableChange.ModifyUniqueConstraint modifyPk = (TableChange.ModifyUniqueConstraint) change;
        applyUniqueConstraint(pendingUpdate, modifyPk.getNewConstraint());
      } else if (change instanceof TableChange.DropConstraint) {
        throw new UnsupportedOperationException("Unsupported table change: DropConstraint.");
      } else {
        throw new UnsupportedOperationException("Cannot apply unknown table change: " + change);
      }
    }
  }

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Remove the ADD WATERMARK clause from the DDL
  2. Manage event-time/watermark semantics in the Flink job (e.g. via watermark strategy on the source) instead of the table schema
  3. Apply other changes in a separate statement that excludes watermark changes

Example fix

// before
ALTER TABLE iceberg_table ADD WATERMARK FOR rowtime AS rowtime - INTERVAL '5' SECOND;
// after
// define WatermarkStrategy in the Flink source/job instead of the Iceberg table
Defensive patterns

Strategy: validation

Validate before calling

if (changes.stream().anyMatch(c -> c instanceof TableChange.AddWatermark)) {
  throw new IllegalArgumentException("Watermark changes are unsupported on Iceberg tables");
}

Try / catch

try {
  FlinkAlterTableUtil.applySchemaChanges(table, changes);
} catch (UnsupportedOperationException e) {
  // strip watermark changes and retry, or fail with a clear user message
}

Prevention

When it happens

Trigger: Executing a Flink SQL `ALTER TABLE ... ADD WATERMARK` (or calling CatalogBaseTable change application) against an Iceberg catalog where the change list contains a TableChange.AddWatermark.

Common situations: Porting Flink SQL DDL written for other connectors (which support watermarks) to an Iceberg table; ORM/schema-sync tools generating watermark clauses.

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/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/b93ec9e6f45ce3f1. Report an issue: GitHub.