{"record":{"id":"88840a9605b10aee","repo":"apache/iceberg","slug":"cannot-apply-unknown-table-change-88840a","errorCode":null,"errorMessage":"Cannot apply unknown table change: ","messagePattern":"Cannot apply unknown table change: ","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/Spark3Util.java","lineNumber":159,"sourceCode":"   * Applies a list of Spark table changes to an {@link UpdateProperties} operation.\n   *\n   * @param pendingUpdate an uncommitted UpdateProperties operation to configure\n   * @param changes a list of Spark table changes\n   * @return the UpdateProperties operation configured with the changes\n   */\n  public static UpdateProperties applyPropertyChanges(\n      UpdateProperties pendingUpdate, List<TableChange> changes) {\n    for (TableChange change : changes) {\n      if (change instanceof TableChange.SetProperty) {\n        TableChange.SetProperty set = (TableChange.SetProperty) change;\n        pendingUpdate.set(set.property(), set.value());\n\n      } else if (change instanceof TableChange.RemoveProperty) {\n        TableChange.RemoveProperty remove = (TableChange.RemoveProperty) change;\n        pendingUpdate.remove(remove.property());\n\n      } else {\n        throw new UnsupportedOperationException(\"Cannot apply unknown table change: \" + change);\n      }\n    }\n\n    return pendingUpdate;\n  }\n\n  /**\n   * Applies a list of Spark table changes to an {@link UpdateSchema} operation.\n   *\n   * @param pendingUpdate an uncommitted UpdateSchema operation to configure\n   * @param changes a list of Spark table changes\n   * @return the UpdateSchema operation configured with the changes\n   */\n  public static UpdateSchema applySchemaChanges(\n      UpdateSchema pendingUpdate, List<TableChange> changes) {\n    for (TableChange change : changes) {\n      if (change instanceof TableChange.AddColumn) {\n        apply(pendingUpdate, (TableChange.AddColumn) change);","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/Spark3Util.java#L141-L177","documentation":"Thrown when Spark3Util.applyPropertyChanges encounters a Spark TableChange type it does not handle. Only SetProperty/RemoveProperty are supported for property updates; any other change type reaches the fallback branch.","triggerScenarios":"Passing a mixed list of TableChange objects (schema changes included) to applyPropertyChanges, or a new Spark TableChange subtype introduced in a newer Spark version.","commonSituations":"ALTER TABLE SET TBLPROPERTIES mixed via generic change APIs; custom catalogs funneling all changes through one helper; Spark upgrade adding new TableChange subclasses not yet mapped.","solutions":["Route schema change types (AddColumn/UpdateColumn/etc.) to applySchemaChanges instead","Only pass SetProperty/RemoveProperty changes to applyPropertyChanges","Upgrade Iceberg to a version supporting the new change type"],"exampleFix":"// before\nspark3Util.applyPropertyChanges(update, allChanges);\n// after\nspark3Util.applyPropertyChanges(update, changes.filter(c -> c instanceof SetProperty || c instanceof RemoveProperty));","handlingStrategy":"type-guard","validationCode":"List<TableChange> safe = changes.stream().filter(c -> c instanceof SetProperty || c instanceof RemoveProperty).collect(toList()); if (safe.size() != changes.size()) { /* route others to applySchemaChanges */ }","typeGuard":"boolean isPropertyChange(TableChange c) { return c instanceof SetProperty || c instanceof RemoveProperty; }","tryCatchPattern":"try { applyPropertyChanges(update, changes); } catch (UnsupportedOperationException e) { LOG.error(\"Unroutable table change: {}\", e.getMessage()); throw e; }","preventionTips":["Partition TableChange lists by type before applying","Pin Iceberg/Spark compatible versions to avoid unknown new change subtypes"],"tags":["spark","table-change","unsupported-operation"],"backgroundTag":"unsupported-operation","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"}