{"record":{"id":"9de60e28d3199bdb","repo":"apache/iceberg","slug":"cannot-apply-unknown-namespace-change-s","errorCode":null,"errorMessage":"Cannot apply unknown namespace change: %s","messagePattern":"Cannot apply unknown namespace 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":539,"sourceCode":"      throw new UnsupportedOperationException(\n          \"Namespaces are not supported by catalog: \" + catalogName);\n    }\n  }\n\n  @Override\n  public void alterNamespace(String[] namespace, NamespaceChange... changes)\n      throws NoSuchNamespaceException {\n    if (asNamespaceCatalog != null) {\n      Map<String, String> updates = Maps.newHashMap();\n      Set<String> removals = Sets.newHashSet();\n      for (NamespaceChange change : changes) {\n        if (change instanceof NamespaceChange.SetProperty) {\n          NamespaceChange.SetProperty set = (NamespaceChange.SetProperty) change;\n          updates.put(set.property(), set.value());\n        } else if (change instanceof NamespaceChange.RemoveProperty) {\n          removals.add(((NamespaceChange.RemoveProperty) change).property());\n        } else {\n          throw new UnsupportedOperationException(\n              \"Cannot apply unknown namespace change: \" + change);\n        }\n      }\n\n      try {\n        if (!updates.isEmpty()) {\n          asNamespaceCatalog.setProperties(Namespace.of(namespace), updates);\n        }\n\n        if (!removals.isEmpty()) {\n          asNamespaceCatalog.removeProperties(Namespace.of(namespace), removals);\n        }\n\n      } catch (org.apache.iceberg.exceptions.NoSuchNamespaceException e) {\n        throw new NoSuchNamespaceException(namespace);\n      }\n    } else {\n      throw new NoSuchNamespaceException(namespace);","sourceCodeStart":521,"sourceCodeEnd":557,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java#L521-L557","documentation":"SparkCatalog.alterNamespace throws UnsupportedOperationException when a NamespaceChange is not SetProperty or RemoveProperty. Only property set/remove changes are currently supported for namespaces; any other change kind is rejected with the change's toString in the message.","triggerScenarios":"Passing a NamespaceChange type other than SetProperty/RemoveProperty to alterNamespace — typically from Spark SQL ALTER NAMESPACE ... with an unsupported clause that maps to a newer change type not handled by this Spark 3.5 code path.","commonSituations":"Running ALTER NAMESPACE with comment/rename semantics against a catalog whose connector version doesn't support them; custom code constructing NamespaceChange variants that SparkCatalog doesn't handle.","solutions":["Restrict namespace changes to SET PROPERTIES and UNSET PROPERTIES","Set namespace comment via a property (e.g. 'comment') instead of a comment clause","Upgrade Iceberg's Spark runtime to a version that handles the change type you need"],"exampleFix":"// before\nspark.sql(\"ALTER NAMESPACE prod.db SET COMMENT 'sales data'\"); // may hit unsupported change\n// after\nspark.sql(\"ALTER NAMESPACE prod.db SET PROPERTIES ('comment'='sales data')\");","handlingStrategy":"validation","validationCode":"boolean supported = java.util.stream.Stream.of(changes)\n    .allMatch(c -> c instanceof NamespaceChange.SetProperty\n        || c instanceof NamespaceChange.RemoveProperty);\nif (!supported) throw new IllegalArgumentException(\"Only property changes supported\");","typeGuard":"boolean isSupportedChange(NamespaceChange c) {\n  return c instanceof NamespaceChange.SetProperty || c instanceof NamespaceChange.RemoveProperty;\n}","tryCatchPattern":"try {\n  catalog.alterNamespace(namespace, changes);\n} catch (UnsupportedOperationException e) {\n  // unsupported change type: fall back to property-based equivalent\n}","preventionTips":["Restrict namespace mutations to SET/UNSET PROPERTIES","Represent comments as properties rather than dedicated clauses","Test ALTER NAMESPACE against your catalog version before rolling out tooling"],"tags":["spark","namespace","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-23T08:17:48.524Z"}