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 SparkCatalog.renameView when the configured catalog does not implement ViewCatalog (asViewCatalog is null), so view renames are impossible. This is an explicit capability error: the catalog only supports tables or lacks view support.

Source

Thrown at spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java:760

      return asViewCatalog.dropView(buildIdentifier(ident));
    }

    return false;
  }

  @Override
  public void renameView(Identifier fromIdentifier, Identifier toIdentifier)
      throws NoSuchViewException, ViewAlreadyExistsException {
    if (null != asViewCatalog) {
      try {
        asViewCatalog.renameView(buildIdentifier(fromIdentifier), buildIdentifier(toIdentifier));
      } catch (org.apache.iceberg.exceptions.NoSuchViewException e) {
        throw new NoSuchViewException(fromIdentifier);
      } catch (org.apache.iceberg.exceptions.AlreadyExistsException e) {
        throw new ViewAlreadyExistsException(toIdentifier);
      }
    } else {
      throw new UnsupportedOperationException(
          "Renaming a view is not supported by catalog: " + catalogName);
    }
  }

  @Override
  public final void initialize(String name, CaseInsensitiveStringMap options) {
    super.initialize(name, options);

    this.cacheEnabled =
        PropertyUtil.propertyAsBoolean(
            options, CatalogProperties.CACHE_ENABLED, CatalogProperties.CACHE_ENABLED_DEFAULT);

    boolean cacheCaseSensitive =
        PropertyUtil.propertyAsBoolean(
            options,
            CatalogProperties.CACHE_CASE_SENSITIVE,
            CatalogProperties.CACHE_CASE_SENSITIVE_DEFAULT);

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Use a catalog implementation that implements ViewCatalog (e.g. HiveCatalog, REST catalog with view support, JDBC catalog).
  2. Update the Iceberg runtime version if the configured catalog should support views but the class predates ViewCatalog.
  3. Drop and recreate the view under the new name manually as a workaround.
  4. Check spark.sql.catalog.<name> points to the intended catalog class.

Example fix

// before
spark.conf.set("spark.sql.catalog.local", "org.apache.iceberg.spark.SparkCatalog");
// after
spark.conf.set("spark.sql.catalog.local", "org.apache.iceberg.hive.HiveCatalog"); // or REST catalog implementing ViewCatalog
Defensive patterns

Strategy: validation

Validate before calling

if (!(catalog instanceof ViewCatalog)) { throw new IllegalStateException("catalog does not support views: " + catalog.name()); }

Type guard

boolean viewRenameSupported = (catalog instanceof ViewCatalog);

Try / catch

try { catalog.renameView(from, to); } catch (UnsupportedOperationException e) { /* fall back to drop+create or use a view-capable catalog */ }

Prevention

When it happens

Trigger: Calling ALTER VIEW RENAME (or SparkCatalog.renameView) on a catalog registered as spark.catalog that is not a ViewCatalog, e.g. HadoopCatalog, a plain TableCatalog, or older Iceberg catalogs without view support.

Common situations: Clusters configured with an Iceberg catalog version/implementation predating ViewCatalog support; using a session catalog that only handles tables; running the same SQL across environments where one env uses a non-view catalog.

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