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

UnsupportedOperationException raised by SparkCatalog.renameView when the wrapped catalog does not implement the ViewCatalog interface (asViewCatalog is null). Spark cannot rename views through a catalog that only supports tables, so the operation is rejected with a message naming the catalog.

Source

Thrown at spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java:787

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

    boolean 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. Switch to a catalog implementation that implements ViewCatalog (HiveCatalog, JDBC Catalog, REST Catalog, Nessie, etc.)
  2. Avoid view DDL against this catalog and manage views elsewhere
  3. Upgrade the custom catalog implementation to add ViewCatalog support

Example fix

// before
spark.conf.set("spark.sql.catalog.local", "org.apache.iceberg.spark.SparkCatalog")
spark.conf.set("spark.sql.catalog.local.catalog-impl", "org.apache.iceberg.hadoop.HadoopCatalog")
// ALTER VIEW local.db.v RENAME TO ... fails
// after
spark.conf.set("spark.sql.catalog.local.catalog-impl", "org.apache.iceberg.jdbc.JdbcCatalog") // ViewCatalog-capable
Defensive patterns

Strategy: type-guard

Validate before calling

// before view DDL, ensure the catalog supports views
if (!(icebergCatalog instanceof org.apache.iceberg.view.ViewCatalog)) {
  throw new UnsupportedOperationException("Catalog does not support views");
}

Type guard

boolean supportsViews = icebergCatalog instanceof org.apache.iceberg.view.ViewCatalog;

Try / catch

try {
  catalog.renameView(fromIdent, toIdent);
} catch (UnsupportedOperationException e) {
  // switch catalog or skip view operations
}

Prevention

When it happens

Trigger: ALTER VIEW ... RENAME TO ... executed against a SparkCatalog whose underlying org.apache.iceberg.catalog.Catalog is not a ViewCatalog (e.g., HadoopCatalog or a custom catalog without view support).

Common situations: Using HadoopCatalog/HadoopTables-style catalogs that never supported views; older custom catalog implementations; running view DDL against a catalog registered without view capability.

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