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 schema updates. Watermark changes are not supported by Iceberg tables, so TableChange.AddWatermark throws UnsupportedOperationException.

Source

Thrown at flink/v2.2/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 — watermarks belong in the query/plan, not the Iceberg table
  2. Define watermark logic in the Flink job's source/windowing instead of the table
  3. If watermark semantics must persist, consider Iceberg watermark-related table properties at the engine level (not via schema change)

Example fix

// before
// ALTER TABLE iceberg_table ADD WATERMARK FOR rowtime AS rowtime - INTERVAL '5' SECOND;
// after: apply watermark at query time, or drop the clause entirely
INSERT INTO iceberg_table SELECT ... ; // watermark handled in the pipeline
Defensive patterns

Strategy: validation

Validate before calling

boolean hasWatermarkChange = java.util.Arrays.stream(changes)
    .anyMatch(c -> c instanceof TableChange.AddWatermark
        || c instanceof TableChange.ModifyWatermark
        || c instanceof TableChange.DropWatermark);
if (hasWatermarkChange) {
  throw new IllegalArgumentException("Iceberg tables do not support watermark table changes");
}

Try / catch

try {
  FlinkAlterTableUtil.applySchemaChanges(update, changes);
} catch (UnsupportedOperationException e) {
  LOG.warn("Ignoring unsupported change for Iceberg: {}", e.getMessage());
  // or rethrow if the change is essential
}

Prevention

When it happens

Trigger: Executing Flink SQL 'ALTER TABLE ... ADD WATERMARK ...' (or calling the API with a TableChange.AddWatermark) against an Iceberg catalog table.

Common situations: Porting Flink SQL DDL written for other connectors to Iceberg; attempts to add event-time watermarks to an Iceberg table schema.

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