{"record":{"id":"99d74d577a01f2bf","repo":"apache/iceberg","slug":"namespaces-are-not-supported-by-catalog-catalogn","errorCode":null,"errorMessage":"Namespaces are not supported by catalog: <catalogName>","messagePattern":"Namespaces are not supported by catalog: <catalogName>","errorType":"exception","errorClass":"java.lang.UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java","lineNumber":494,"sourceCode":"\n  @Override\n  public void createNamespace(String[] namespace, Map<String, String> metadata)\n      throws NamespaceAlreadyExistsException {\n    if (asNamespaceCatalog != null) {\n      try {\n        if (asNamespaceCatalog instanceof HadoopCatalog\n            && DEFAULT_NS_KEYS.equals(metadata.keySet())) {\n          // Hadoop catalog will reject metadata properties, but Spark automatically adds \"owner\".\n          // If only the automatic properties are present, replace metadata with an empty map.\n          asNamespaceCatalog.createNamespace(Namespace.of(namespace), ImmutableMap.of());\n        } else {\n          asNamespaceCatalog.createNamespace(Namespace.of(namespace), metadata);\n        }\n      } catch (AlreadyExistsException e) {\n        throw new NamespaceAlreadyExistsException(namespace);\n      }\n    } else {\n      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(","sourceCodeStart":476,"sourceCodeEnd":512,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java#L476-L512","documentation":"createNamespace requires the underlying catalog to implement SupportsNamespaces. When asNamespaceCatalog is null, SparkCatalog throws UnsupportedOperationException stating namespaces are not supported by the given catalog name — the operation is impossible for this backend.","triggerScenarios":"CREATE NAMESPACE against a catalog whose implementation only implements TableCatalog (e.g. custom or limited catalog plugins registered via spark.sql.catalog.<name>).","commonSituations":"Misconfigured catalog class; using the session catalog with a namespace-less backend; assuming Hadoop-style hierarchical namespaces work everywhere.","solutions":["Configure a namespace-capable catalog (HadoopCatalog, JDBCCatalog, RESTCatalog, NessieCatalog, etc.)","Check `catalog instanceof SupportsNamespaces` before issuing namespace operations","Create tables with fully qualified identifiers that the backend does support, or pre-create namespaces outside Spark"],"exampleFix":"// before\nspark.conf.set(\"spark.sql.catalog.local\", \"com.example.FlatTableCatalog\"); spark.sql(\"CREATE NAMESPACE local.db\");\n// after\nspark.conf.set(\"spark.sql.catalog.local\", \"org.apache.iceberg.spark.SparkCatalog\"); spark.conf.set(\"spark.sql.catalog.local.warehouse\", \"/tmp/warehouse\"); spark.sql(\"CREATE NAMESPACE local.db\");","handlingStrategy":"validation","validationCode":"if (!(icebergCatalog instanceof SupportsNamespaces)) { throw new IllegalStateException(\"catalog \" + catalogName + \" does not support namespaces\"); }","typeGuard":"boolean canCreateNamespace(CatalogPlugin c) { return c instanceof SupportsNamespaces; }","tryCatchPattern":"try { spark.sql(\"CREATE NAMESPACE ns\"); } catch (UnsupportedOperationException e) { /* reconfigure catalog or skip */ }","preventionTips":["Choose catalog implementations that support namespaces up front","Document per-catalog capability limits in your platform configs","Test namespace operations during catalog onboarding"],"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"}