{"record":{"id":"e854c4f6f118d76c","repo":"apache/iceberg","slug":"cannot-apply-unknown-table-change-s","errorCode":null,"errorMessage":"Cannot apply unknown table change: %s","messagePattern":"Cannot apply unknown table change: (.+?)","errorType":"exception","errorClass":"java.lang.UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java","lineNumber":356,"sourceCode":"        } else if (\"cherry-pick-snapshot-id\".equalsIgnoreCase(set.property())) {\n          pickSnapshotId = set;\n        } else if (\"sort-order\".equalsIgnoreCase(set.property())) {\n          throw new UnsupportedOperationException(\n              \"Cannot specify the 'sort-order' because it's a reserved table \"\n                  + \"property. Please use the command 'ALTER TABLE ... WRITE ORDERED BY' to specify write sort-orders.\");\n        } else if (\"identifier-fields\".equalsIgnoreCase(set.property())) {\n          throw new UnsupportedOperationException(\n              \"Cannot specify the 'identifier-fields' because it's a reserved table property. \"\n                  + \"Please use the command 'ALTER TABLE ... SET IDENTIFIER FIELDS' to specify identifier fields.\");\n        } else {\n          propertyChanges.add(set);\n        }\n      } else if (change instanceof RemoveProperty) {\n        propertyChanges.add(change);\n      } else if (change instanceof ColumnChange) {\n        schemaChanges.add(change);\n      } else {\n        throw new UnsupportedOperationException(\"Cannot apply unknown table change: \" + change);\n      }\n    }\n\n    try {\n      org.apache.iceberg.Table table = icebergCatalog.loadTable(buildIdentifier(ident));\n      commitChanges(\n          table, setLocation, setSnapshotId, pickSnapshotId, propertyChanges, schemaChanges);\n      return new SparkTable(table, true /* refreshEagerly */);\n    } catch (org.apache.iceberg.exceptions.NoSuchTableException e) {\n      throw new NoSuchTableException(ident);\n    }\n  }\n\n  @Override\n  public boolean dropTable(Identifier ident) {\n    return catalogDropTable(ident);\n  }\n","sourceCodeStart":338,"sourceCodeEnd":374,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java#L338-L374","documentation":"Spark's alterTable receives a list of TableChange objects; SparkCatalog maps recognized types (SetProperty/RemoveProperty/ColumnChange) to Iceberg operations. Any other TableChange subtype has no Iceberg equivalent, so alterTable throws this UnsupportedOperationException at line 356.","triggerScenarios":"Calling Spark's catalog.alterTable with an unhandled org.apache.spark.sql.connector.catalog.TableChange subclass (neither SetProperty, RemoveProperty, nor a ColumnChange); future/Custom TableChange implementations introduced by plugins or newer Spark versions not yet mapped by this SparkCatalog.","commonSituations":"Using a Spark version or extension that emits new TableChange types the vendored Iceberg v3.5 connector does not understand; custom catalog integrations passing through bespoke changes; library version mismatch between Spark and Iceberg runtime.","solutions":["Check that only supported changes are issued (properties and column changes).","Upgrade the iceberg-spark runtime to a version matching your Spark minor version so new TableChange types are mapped.","Split the operation into supported SET/REMOVE PROPERTY and column changes.","Submit an issue/patch to Iceberg to handle the new TableChange type."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"for (TableChange c : changes) { if (!(c instanceof SetProperty || c instanceof RemoveProperty || c instanceof ColumnChange)) { throw new IllegalArgumentException(\"unsupported change: \" + c); } }","typeGuard":"null","tryCatchPattern":"try { catalog.alterTable(ident, changes); } catch (UnsupportedOperationException e) { log.error(\"TableChange {} not supported\", e.getMessage()); }","preventionTips":["Keep Iceberg spark runtime version aligned with the Spark minor version.","Only issue supported TableChange types in custom code.","Test schema/property changes against the exact connector version."],"tags":["spark","alter-table","unsupported-change"],"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"}