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

renameView in SparkSessionCatalog only renames views when either an injected view catalog or the session catalog implements ViewCatalog. When neither does, it throws this UnsupportedOperationException. It means the catalog has no view namespace to perform the rename in.

Source

Thrown at spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/SparkSessionCatalog.java:651

      return asViewCatalog.dropView(ident);
    } else if (isViewCatalog()) {
      return getSessionCatalog().dropView(ident);
    }

    return false;
  }

  @Override
  public void renameView(Identifier fromIdentifier, Identifier toIdentifier)
      throws NoSuchViewException, ViewAlreadyExistsException {
    checkTableNotExists(toIdentifier);

    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);
    }
  }

  private void checkTableNotExists(Identifier ident) throws ViewAlreadyExistsException {
    if (tableExists(ident)) {
      throw new ViewAlreadyExistsException(ident);
    }
  }

  private void checkViewNotExists(Identifier ident) throws TableAlreadyExistsException {
    if (viewExists(ident)) {
      throw new TableAlreadyExistsException(ident);
    }
  }
}

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Switch to a catalog implementation that supports views (Hive, JDBC, REST with view support)
  2. Register an asViewCatalog ViewCatalog so renameView can be delegated
  3. Rename the view manually in the view-capable catalog (DROP + CREATE with new name)
  4. Avoid view DDL against this catalog entirely

Example fix

// before
unsupportedCatalog.renameView(oldIdent, newIdent); // throws
// after
if (catalog instanceof ViewCatalog) {
  ((ViewCatalog) catalog).renameView(oldIdent, newIdent);
} else {
  throw new IllegalStateException("Configure a ViewCatalog to rename views");
}
Defensive patterns

Strategy: type-guard

Validate before calling

boolean canRename = catalog instanceof org.apache.iceberg.view.ViewCatalog;

Type guard

if (!(catalog instanceof org.apache.iceberg.view.ViewCatalog)) {
  throw new IllegalStateException("renameView requires a ViewCatalog");
}

Try / catch

try {
  catalog.renameView(fromIdent, toIdent);
} catch (UnsupportedOperationException e) {
  // fall back to drop+create in a view-capable catalog or surface a config error
}

Prevention

When it happens

Trigger: Calling catalog.renameView(fromIdentifier, toIdentifier) when asViewCatalog is null (or the view doesn't exist in it) and the session catalog is not a ViewCatalog.

Common situations: RENAME VIEW / ALTER VIEW RENAME TO SQL against a table-only Iceberg catalog; misconfigured catalog-impl lacking view support; confusion between Spark's built-in session catalog and the Iceberg catalog for view operations.

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