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
SparkSessionCatalog.renameView renames a view through a delegate view catalog when one exists, or the session view catalog if this catalog is itself a view catalog. With neither available, it throws this UnsupportedOperationException, indicating the catalog for catalogName cannot manage views at all.
Source
Thrown at spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/SparkSessionCatalog.java:561
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
- Point the catalog at a ViewCatalog implementation so rename is delegated correctly.
- Recreate the view under the new name manually: CREATE VIEW new AS <query>; DROP VIEW old;
- Upgrade Iceberg if the target catalog supports views but the bundled Spark runtime version predates view support.
Example fix
// before
spark.sql("ALTER VIEW old_view RENAME TO new_view") // throws
// after
spark.sql("CREATE VIEW new_view AS SELECT * FROM old_view")
spark.sql("DROP VIEW old_view") Defensive patterns
Strategy: try-catch
Validate before calling
ViewCatalog vc = ((SparkCatalog) sparkCatalog).asViewCatalog();
if (vc == null) { /* rename unsupported: recreate under new name */ } Type guard
boolean supportsRenameView = sparkCatalog instanceof ViewCatalog
|| (sparkCatalog instanceof SparkCatalog && ((SparkCatalog) sparkCatalog).asViewCatalog() != null); Try / catch
try {
catalog.renameView(from, to);
} catch (UnsupportedOperationException e) {
if (e.getMessage().contains("Renaming a view")) { /* fallback: create to; drop from */ }
else throw e;
} Prevention
- Avoid ALTER VIEW RENAME workflows on catalogs without view support.
- Document view capabilities per catalog in your platform config.
- Prefer catalogs with ViewCatalog (Iceberg 1.4+ backends) for view lifecycle operations.
When it happens
Trigger: Calling renameView(fromIdentifier, toIdentifier) (e.g. ALTER VIEW ... RENAME TO ...) when asViewCatalog is null or does not contain the source view and isViewCatalog() is false.
Common situations: Renaming views in catalogs lacking ViewCatalog support; confusion between table and view namespaces; migrating to a catalog version that predates Iceberg view support (views only exist since Iceberg 1.4).
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:
- Cannot rename %s to %s. View does not exist
- Cannot rename %s to %s. View already exists
- View does not exist: %s
- Renaming a view is not supported by catalog: catalogName
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/2bac5272ed42792e.
Report an issue: GitHub.