apache/iceberg · error · UnsupportedOperationException

Unsupported table change: ModifyWatermark.

Error message

Unsupported table change: ModifyWatermark.

What it means

Iceberg tables have no watermark concept, so FlinkAlterTableUtil.applySchemaChanges explicitly rejects TableChange.ModifyWatermark with UnsupportedOperationException. The schema update is aborted before commit.

Source

Thrown at flink/v2.1/flink/src/main/java/org/apache/iceberg/flink/util/FlinkAlterTableUtil.java:137

   *
   * @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);
      }
    }
  }

  private static void applyAddColumn(UpdateSchema pendingUpdate, TableChange.AddColumn addColumn) {
    Column flinkColumn = addColumn.getColumn();

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Drop the watermark modification; set watermark strategy in the consuming Flink job or on a view
  2. Re-create the view over the Iceberg table with the desired watermark expression

Example fix

-- before
ALTER TABLE iceberg_table MODIFY WATERMARK FOR rowtime AS rowtime - INTERVAL '10' SECOND;
-- after
CREATE OR REPLACE VIEW v AS SELECT *, rowtime - INTERVAL '10' SECOND AS wm FROM iceberg_table;
Defensive patterns

Strategy: try-catch

Validate before calling

if (changes.stream().anyMatch(c -> c instanceof TableChange.ModifyWatermark)) {
  throw new IllegalArgumentException("MODIFY WATERMARK is not supported on Iceberg tables");
}

Type guard

boolean isWatermarkChange(TableChange c) { return c instanceof TableChange.AddWatermark || c instanceof TableChange.ModifyWatermark || c instanceof TableChange.DropWatermark; }

Try / catch

try {
  FlinkAlterTableUtil.applySchemaChanges(update, changes);
} catch (UnsupportedOperationException e) {
  if (e.getMessage().contains("ModifyWatermark")) { /* adjust watermark on view instead */ }
  throw e;
}

Prevention

When it happens

Trigger: Running 'ALTER TABLE ... MODIFY WATERMARK ...' (or MODIFY WATERMARK LEVEL) via Flink SQL on an Iceberg-catalog table.

Common situations: Trying to adjust watermark delay on an Iceberg table after porting DDL from a Flink filesystem/inline-connector table.

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/7e3adc850e8fc657. Report an issue: GitHub.