apache/iceberg · warning · UnsupportedOperationException

Cannot set namespace properties " + namespace + " : setPrope

Error message

Cannot set namespace properties " + namespace + " : setProperties is not supported

What it means

HadoopCatalog does not support setting properties on a namespace: namespace metadata in the Hadoop filesystem layout is just a directory with a fixed 'location' entry. Any call to setProperties throws UnsupportedOperationException unconditionally.

Source

Thrown at core/src/main/java/org/apache/iceberg/hadoop/HadoopCatalog.java:356

    if (!isNamespace(nsPath) || namespace.isEmpty()) {
      return false;
    }

    try {
      if (fs.listStatusIterator(nsPath).hasNext()) {
        throw new NamespaceNotEmptyException("Namespace %s is not empty.", namespace);
      }

      return fs.delete(nsPath, false /* recursive */);
    } catch (IOException e) {
      throw new RuntimeIOException(e, "Namespace delete failed: %s", namespace);
    }
  }

  @Override
  public boolean setProperties(Namespace namespace, Map<String, String> properties) {
    throw new UnsupportedOperationException(
        "Cannot set namespace properties " + namespace + " : setProperties is not supported");
  }

  @Override
  public boolean removeProperties(Namespace namespace, Set<String> properties) {
    throw new UnsupportedOperationException(
        "Cannot remove properties " + namespace + " : removeProperties is not supported");
  }

  @Override
  public Map<String, String> loadNamespaceMetadata(Namespace namespace) {
    Path nsPath = new Path(warehouseLocation, SLASH.join(namespace.levels()));

    if (!isNamespace(nsPath) || namespace.isEmpty()) {
      throw new NoSuchNamespaceException("Namespace does not exist: %s", namespace);
    }

    return ImmutableMap.of("location", nsPath.toString());

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Switch to a catalog implementation that supports namespace properties (HiveCatalog, JDBC catalog, REST catalog).
  2. Remove the setProperties call for HadoopCatalog; there are no supported namespace properties.
  3. Handle UnsupportedOperationException if your code must work across catalog types.
  4. Store custom metadata out-of-band (e.g. in a properties file in the namespace directory via FileIO) if truly needed.

Example fix

// before
catalog.setProperties(Namespace.of("db"), ImmutableMap.of("owner", "data-team"));
// after
if (catalog instanceof HadoopCatalog) {
  throw new UnsupportedOperationException("HadoopCatalog does not support namespace properties");
} else {
  catalog.setProperties(Namespace.of("db"), ImmutableMap.of("owner", "data-team"));
}
Defensive patterns

Strategy: fallback

Validate before calling

if (catalog instanceof HadoopCatalog) {
  // skip setProperties: unsupported
}

Type guard

boolean supportsNsProps = !(catalog instanceof HadoopCatalog);

Try / catch

try {
  catalog.setProperties(ns, props);
} catch (UnsupportedOperationException e) {
  LOG.warn("Catalog {} does not support namespace properties", catalog.getClass().getSimpleName());
}

Prevention

When it happens

Trigger: Calling catalog.setProperties(namespace, props) on a HadoopCatalog instance — e.g. from testAlterNamespaceMeta-style code or engine integrations that generically call the NamespaceOperations API.

Common situations: Code written against HiveCatalog or RESTCatalog being reused with HadoopCatalog; framework code that updates namespace properties for all catalog implementations; migration from a catalog that supports properties to the Hadoop-based one.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/7720dfc9bc3277c4. Report an issue: GitHub.