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
SparkCatalog delegates view operations to an underlying Iceberg catalog only when that catalog implements the ViewCatalog interface (asViewCatalog). renameView() throws this UnsupportedOperationException when the configured catalog does not support views, so rename cannot be performed at all. It is a capability error, not a data or state error: the catalog backend (e.g. HadoopCatalog or an older custom catalog) simply has no view registry.
Source
Thrown at spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java:763
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
- Check whether the underlying catalog supports views: it must implement org.apache.iceberg.view.ViewCatalog (e.g. HiveCatalog, RESTCatalog, JDBC catalog with a views table); switch to a catalog implementation that does.
- If the catalog supports views, verify the catalog configuration (spark.sql.catalog.<name>) actually points to the view-capable implementation rather than a fallback like HadoopTables/HadoopCatalog.
- Work around by drop + create: DROP VIEW old_name; CREATE VIEW new_name AS <query> (accepting that lineage of the view definition is rebuilt manually).
- Upgrade Iceberg if the backend (e.g. older REST server) does not yet expose view endpoints.
Example fix
// before (unsupported catalog)
ALTER VIEW iceberg_catalog.db.v RENAME TO iceberg_catalog.db.v2;
// after: use a view-capable catalog
spark.conf.set("spark.sql.catalog.rest", "org.apache.iceberg.spark.SparkCatalog");
spark.conf.set("spark.sql.catalog.rest.catalog-impl", "org.apache.iceberg.rest.RESTCatalog");
ALTER VIEW rest.db.v RENAME TO rest.db.v2; Defensive patterns
Strategy: validation
Validate before calling
Catalog iceberg = /* resolved SparkCatalog's underlying catalog */;
if (!(iceberg instanceof org.apache.iceberg.view.ViewCatalog)) {
throw new IllegalStateException("Catalog " + name + " does not support views; ALTER VIEW RENAME unavailable");
} Type guard
boolean supportsViews = org.apache.iceberg.catalog.Catalog.class.isInstance(iceberg)
&& iceberg instanceof org.apache.iceberg.view.ViewCatalog; Try / catch
try {
spark.sql("ALTER VIEW " + name + " RENAME TO " + newName);
} catch (UnsupportedOperationException e) {
if (e.getMessage().contains("Renaming a view is not supported")) {
// fall back to drop+create or switch catalog
} else {
throw e;
}
} Prevention
- Pick a ViewCatalog-backed implementation (HiveCatalog, RESTCatalog, JDBC with view tables) when views are required.
- Assert catalog capability at session setup: `sparkCatalog.icebergCatalog() instanceof ViewCatalog`.
- Keep Iceberg version >= view support for your chosen backend.
When it happens
Trigger: Calling ALTER VIEW ... RENAME TO (or SparkCatalog.renameView(fromIdentifier, toIdentifier)) on a catalog whose underlying Iceberg catalog is not a ViewCatalog. In initialize(), asViewCatalog stays null for such catalogs, so line 763 is always hit for any renameView call.
Common situations: Using spark.sql.catalog.<name>=org.apache.iceberg.hive.HiveCatalog or another implementation without ViewCatalog support, or an older Iceberg catalog version that predates view support, then running ALTER VIEW my_view RENAME TO new_name.
Related errors
- Creating a view is not supported by catalog: ${catalogName}
- Replacing a view is not supported by catalog: ${catalogName}
- Altering a view is not supported by catalog: ${catalogName}
- Renaming a view is not supported by catalog: ${catalogName}
- Creating or replacing a view is not supported by catalog: ${
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/8906d9d62505155b.
Report an issue: GitHub.