{"record":{"id":"ef1d9f78295dd406","repo":"apache/iceberg","slug":"unsupported-table-change-addwatermark-ef1d9f","errorCode":null,"errorMessage":"Unsupported table change: AddWatermark.","messagePattern":"Unsupported table change: AddWatermark\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/util/FlinkAlterTableUtil.java","lineNumber":135,"sourceCode":"  /**\n   * Applies a list of Flink table changes to an {@link UpdateSchema} operation.\n   *\n   * @param pendingUpdate an uncommitted UpdateSchema operation to configure\n   * @param schemaChanges a list of Flink table changes\n   */\n  public static void applySchemaChanges(\n      UpdateSchema pendingUpdate, List<TableChange> schemaChanges) {\n    for (TableChange change : schemaChanges) {\n      if (change instanceof TableChange.AddColumn) {\n        applyAddColumn(pendingUpdate, (TableChange.AddColumn) change);\n      } else if (change instanceof TableChange.ModifyColumn) {\n        TableChange.ModifyColumn modifyColumn = (TableChange.ModifyColumn) change;\n        applyModifyColumn(pendingUpdate, modifyColumn);\n      } else if (change instanceof TableChange.DropColumn) {\n        TableChange.DropColumn dropColumn = (TableChange.DropColumn) change;\n        pendingUpdate.deleteColumn(dropColumn.getColumnName());\n      } else if (change instanceof TableChange.AddWatermark) {\n        throw new UnsupportedOperationException(\"Unsupported table change: AddWatermark.\");\n      } else if (change instanceof TableChange.ModifyWatermark) {\n        throw new UnsupportedOperationException(\"Unsupported table change: ModifyWatermark.\");\n      } else if (change instanceof TableChange.DropWatermark) {\n        throw new UnsupportedOperationException(\"Unsupported table change: DropWatermark.\");\n      } else if (change instanceof TableChange.AddUniqueConstraint) {\n        TableChange.AddUniqueConstraint addPk = (TableChange.AddUniqueConstraint) change;\n        applyUniqueConstraint(pendingUpdate, addPk.getConstraint());\n      } else if (change instanceof TableChange.ModifyUniqueConstraint) {\n        TableChange.ModifyUniqueConstraint modifyPk = (TableChange.ModifyUniqueConstraint) change;\n        applyUniqueConstraint(pendingUpdate, modifyPk.getNewConstraint());\n      } else if (change instanceof TableChange.DropConstraint) {\n        throw new UnsupportedOperationException(\"Unsupported table change: DropConstraint.\");\n      } else {\n        throw new UnsupportedOperationException(\"Cannot apply unknown table change: \" + change);\n      }\n    }\n  }\n","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/util/FlinkAlterTableUtil.java#L117-L153","documentation":"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.","triggerScenarios":"Executing 'ALTER TABLE ... ADD WATERMARK' (Flink SQL watermark statement) against a table routed through the Iceberg catalog's alterTable path.","commonSituations":"Flink SQL DDL that declares watermarks on Iceberg tables; SQL clients generating watermark table features that the Iceberg spec/catalog layer does not carry.","solutions":["Remove the ADD WATERMARK clause; declare watermarks on the Flink source table/DDL view instead of the Iceberg table.","Apply time-attribute/watermark logic in the Flink pipeline (event-time on source), not as a table-level change.","Track Iceberg/Flink support for watermark table features and upgrade when available."],"exampleFix":"// before\nALTER TABLE iceberg_table ADD WATERMARK FOR rowtime AS rowtime - INTERVAL '5' SECOND;\n// after\n// define watermark in the Flink source DDL, not on the Iceberg table:\nCREATE TABLE kafka_src (... , WATERMARK FOR rowtime AS rowtime - INTERVAL '5' SECOND) ...","handlingStrategy":"validation","validationCode":"if (changes.stream().anyMatch(c -> c instanceof TableChange.AddWatermark)) { throw new IllegalArgumentException('Watermark changes are not supported on Iceberg tables'); }","typeGuard":null,"tryCatchPattern":"try { catalog.alterTable(tableIdent, changes); } catch (UnsupportedOperationException e) { LOG.warn('Unsupported DDL on Iceberg table: {}', e.getMessage()); }","preventionTips":["Keep watermark declarations in Flink source DDL, not Iceberg table DDL","Filter TableChange lists before passing to the Iceberg catalog","Review Flink-to-Iceberg DDL compatibility matrices before migrating SQL scripts"],"tags":["flink","sql","schema-change","unsupported"],"backgroundTag":"operation-not-supported","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}