apache/iceberg · error · UnsupportedOperationException

Unsupported table change: AddWatermark.

Error message

Unsupported table change: AddWatermark.

What it means

applySchemaChanges translates Flink TableChange objects into Iceberg Schema updates via a pending update. Watermark changes are not supported by this Flink-to-Iceberg bridge, so AddWatermark throws UnsupportedOperationException unconditionally.

Source

Thrown at flink/v2.3/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; declare watermarks on the Flink source table/DDL view instead of the Iceberg table.
  2. Apply time-attribute/watermark logic in the Flink pipeline (event-time on source), not as a table-level change.
  3. Track Iceberg/Flink support for watermark table features and upgrade when available.

Example fix

// before
ALTER TABLE iceberg_table ADD WATERMARK FOR rowtime AS rowtime - INTERVAL '5' SECOND;
// after
// define watermark in the Flink source DDL, not on the Iceberg table:
CREATE TABLE kafka_src (... , WATERMARK FOR rowtime AS rowtime - INTERVAL '5' SECOND) ...
Defensive patterns

Strategy: validation

Validate before calling

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

Try / catch

try { catalog.alterTable(tableIdent, changes); } catch (UnsupportedOperationException e) { LOG.warn('Unsupported DDL on Iceberg table: {}', e.getMessage()); }

Prevention

When it happens

Trigger: Executing 'ALTER TABLE ... ADD WATERMARK' (Flink SQL watermark statement) against a table routed through the Iceberg catalog's alterTable path.

Common situations: Flink SQL DDL that declares watermarks on Iceberg tables; SQL clients generating watermark table features that the Iceberg spec/catalog layer does not carry.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/ef1d9f78295dd406. Report an issue: GitHub.