apache/iceberg · error · UnsupportedOperationException

Creating a view is not supported by catalog: ${catalogName}

Error message

Creating a view is not supported by catalog: ${catalogName}

What it means

Thrown by SparkSessionCatalog.createView when no underlying catalog supports view creation: there is no Iceberg ViewCatalog (asViewCatalog is null) and the session catalog is not a view catalog. View support is optional; catalogs without it must reject view DDL.

Source

Thrown at spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/SparkSessionCatalog.java:472

    }

    throw new NoSuchViewException(ident);
  }

  @Override
  public View createView(ViewInfo viewInfo)
      throws ViewAlreadyExistsException, NoSuchNamespaceException {
    if (viewInfo == null) {
      return null;
    }

    if (null != asViewCatalog) {
      return asViewCatalog.createView(viewInfo);
    } else if (isViewCatalog()) {
      return getSessionCatalog().createView(viewInfo);
    }

    throw new UnsupportedOperationException(
        "Creating a view is not supported by catalog: " + catalogName);
  }

  @Override
  public View replaceView(
      Identifier ident,
      String sql,
      String currentCatalog,
      String[] currentNamespace,
      StructType schema,
      String[] queryColumnNames,
      String[] columnAliases,
      String[] columnComments,
      Map<String, String> properties)
      throws NoSuchNamespaceException, NoSuchViewException {
    if (asViewCatalog instanceof SupportsReplaceView) {
      return ((SupportsReplaceView) asViewCatalog)
          .replaceView(

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Register a catalog that supports views (Iceberg ViewCatalog, e.g. REST/Hive catalog with view support) and route the DDL to it.
  2. Upgrade Iceberg if the delegate catalog's view support exists in a newer version.
  3. Avoid CREATE VIEW against this catalog; store views in a catalog that supports them.

Example fix

// before
CREATE VIEW spark_catalog.db.v AS SELECT ...  // unsupported delegate
// after
CREATE VIEW iceberg_catalog.db.v AS SELECT ...  // catalog with view support
Defensive patterns

Strategy: type-guard

Validate before calling

boolean viewSupported = (catalog instanceof SparkSessionCatalog<?> sc) /* delegate is ViewCatalog */;

Type guard

boolean supportsCreateView(Catalog catalog) {
  return catalog instanceof ViewCatalog;
}

Try / catch

try { catalog.createView(viewInfo); } catch (UnsupportedOperationException e) { /* fall back to a view-capable catalog */ }

Prevention

When it happens

Trigger: Executing CREATE VIEW against a session catalog whose delegate does not implement ViewCatalog and where no Iceberg view catalog is registered.

Common situations: Using an older Iceberg version or a delegate catalog (e.g. simple Hive or in-memory catalog) without view support; user expects CREATE VIEW to work after registering SparkSessionCatalog.

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/87e5ef8e2b53284a. Report an issue: GitHub.