apache/iceberg · error · UnsupportedOperationException
Renaming a view is not supported by catalog:
Error message
Renaming a view is not supported by catalog:
What it means
renameView in SparkSessionCatalog throws UnsupportedOperationException when neither the delegate view catalog nor the session catalog supports view renaming. Like other view operations, it is only available through a ViewCatalog-capable underlying catalog.
Source
Thrown at spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/SparkSessionCatalog.java:579
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
- Rename via DROP VIEW + CREATE VIEW in a view-capable catalog
- Register an Iceberg view-capable catalog (REST/Hive with views) and perform the rename there
- Rename the view in the underlying metastore directly if it is a session/Hive view
Example fix
// before
spark.sql("ALTER VIEW iceberg.db.v1 RENAME TO iceberg.db.v2"); // unsupported
// after
spark.sql("CREATE VIEW spark_catalog.db.v2 AS SELECT * FROM spark_catalog.db.v1");
spark.sql("DROP VIEW spark_catalog.db.v1"); Defensive patterns
Strategy: fallback
Type guard
boolean supportsViewRename(Catalog c) { return c instanceof ViewCatalog; } Try / catch
try {
catalog.renameView(from, to);
} catch (UnsupportedOperationException e) {
// fall back to DROP + CREATE
} Prevention
- Avoid ALTER VIEW RENAME on catalogs without view support; script DROP+CREATE instead
- Consolidate views in one view-capable catalog so rename is available
When it happens
Trigger: Executing ALTER VIEW ... RENAME TO on a catalog without ViewCatalog support; both asViewCatalog checks and isViewCatalog() fail so the else branch throws.
Common situations: Renaming views in spark_catalog backed by a table-only delegate; migration scripts assuming view rename works everywhere; Spark versions where session catalogs lack view rename.
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
- Renaming a view is not supported by catalog: catalogName
- Creating a view is not supported by catalog: catalogName
- Replacing a view is not supported by catalog: catalogName
- Renaming a view is not supported by catalog: catalogName
- Creating a view is not supported by catalog: ${catalogName}
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/68bc142c4cd17693.
Report an issue: GitHub.