apache/iceberg · error · UnsupportedOperationException

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

Error message

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

What it means

Thrown by SparkSessionCatalog.renameView when no underlying catalog supports view renaming: the source view does not resolve to a view-capable catalog and the session catalog is not a view catalog. ALTER VIEW ... RENAME TO cannot be performed.

Source

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

  public boolean dropView(Identifier ident) {
    if (null != asViewCatalog && asViewCatalog.viewExists(ident)) {
      return asViewCatalog.dropView(ident);
    } else if (isViewCatalog()) {
      return getSessionCatalog().dropView(ident);
    }

    return false;
  }

  @Override
  public void renameView(Identifier fromIdentifier, Identifier toIdentifier)
      throws NoSuchViewException, ViewAlreadyExistsException {
    if (null != asViewCatalog && asViewCatalog.viewExists(fromIdentifier)) {
      asViewCatalog.renameView(fromIdentifier, toIdentifier);
    } else if (isViewCatalog()) {
      getSessionCatalog().renameView(fromIdentifier, toIdentifier);
    } else {
      throw new UnsupportedOperationException(
          "Renaming a view is not supported by catalog: " + catalogName);
    }
  }
}

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Point the rename at a catalog with view support by fully qualifying the source identifier.
  2. Recreate the view under the new name (CREATE VIEW new AS SELECT from old) then drop the old one.
  3. Configure a ViewCatalog-capable delegate for the session catalog.

Example fix

// before
ALTER VIEW spark_catalog.db.old_v RENAME TO db.new_v  // unsupported
// after
CREATE VIEW spark_catalog.db.new_v AS SELECT * FROM spark_catalog.db.old_v;
DROP VIEW spark_catalog.db.old_v
Defensive patterns

Strategy: type-guard

Validate before calling

if (!catalog.viewExists(fromIdentifier)) { throw new IllegalStateException("cannot rename missing view: " + fromIdentifier); }

Type guard

boolean canRenameView(Catalog catalog, Identifier from) { return catalog instanceof ViewCatalog && ((ViewCatalog) catalog).viewExists(from); }

Try / catch

try { catalog.renameView(from, to); } catch (UnsupportedOperationException e) { /* create-new + drop-old fallback */ }

Prevention

When it happens

Trigger: Executing ALTER VIEW ... RENAME TO where fromIdentifier is not found in any registered view catalog and the session catalog lacks ViewCatalog support.

Common situations: Renaming views against legacy catalogs without view support; source view name typo so the view-capable branch never executes.

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/3fbeff88efe59bd5. Report an issue: GitHub.