apache/iceberg · error · UnsupportedOperationException
Altering a view is not supported by catalog: catalogName
Error message
Altering a view is not supported by catalog: catalogName
What it means
SparkSessionCatalog.alterView only delegates to a configured view catalog (asViewCatalog) or the session view catalog when isViewCatalog() holds. When neither applies, it throws this UnsupportedOperationException because there is no view-capable backend for catalogName to apply ViewChange operations to.
Solutions
- Use a catalog implementation that implements ViewCatalog (REST, Hive, JDBC, Nessie, etc.) for this catalog name.
- Drop and recreate the view with the desired definition/properties instead of altering.
- Verify catalog configuration so the delegate view catalog is wired (spark.sql.catalog.<name> points to a view-capable implementation).
Example fix
// before
spark.sql("ALTER VIEW my_view SET TBLPROPERTIES ('a'='b')") // throws
// after
spark.sql("DROP VIEW my_view")
spark.sql("CREATE VIEW my_view TBLPROPERTIES ('a'='b') AS SELECT * FROM t") Defensive patterns
Strategy: try-catch
Validate before calling
ViewCatalog vc = ((SparkCatalog) sparkCatalog).asViewCatalog();
if (vc == null || !vc.viewExists(ident)) { /* alter not possible via this catalog */ } Type guard
boolean supportsAlterView = sparkCatalog instanceof ViewCatalog
|| (sparkCatalog instanceof SparkCatalog && ((SparkCatalog) sparkCatalog).asViewCatalog() != null); Try / catch
try {
catalog.alterView(ident, changes);
} catch (UnsupportedOperationException e) {
if (e.getMessage().contains("Altering a view")) { /* fall back to drop+create */ }
else throw e;
} Prevention
- Verify the catalog backend supports ViewCatalog before issuing ALTER VIEW statements.
- Keep view DDL in catalogs known to support views (REST, Hive, JDBC, Nessie).
- Test view DDL against the target catalog in CI before migrating view-heavy workloads.
When it happens
Trigger: Calling alterView(ident, changes...) (e.g. ALTER VIEW ... via Spark) when asViewCatalog is null or the view is not present in it, and isViewCatalog() is false.
Common situations: Running ALTER VIEW SET TBLPROPERTIES / ALTER VIEW AS SELECT against catalogs without ViewCatalog support (plain Hadoop catalog, unsupported third-party catalog, or a session catalog configured only for tables).
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
- Altering a view is not supported by catalog:
- Altering a view is not supported by catalog
- Altering a view is not supported by catalog
- Creating a view is not supported by catalog:
- Creating a view is not supported by catalog
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/ea297e6f38909293.
Report an issue: GitHub.
Appendix: source
Thrown at spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/SparkSessionCatalog.java:538
columnAliases,
columnComments,
properties);
}
throw new UnsupportedOperationException(
"Replacing a view is not supported by catalog: " + catalogName);
}
@Override
public View alterView(Identifier ident, ViewChange... changes)
throws NoSuchViewException, IllegalArgumentException {
if (null != asViewCatalog && asViewCatalog.viewExists(ident)) {
return asViewCatalog.alterView(ident, changes);
} else if (isViewCatalog()) {
return getSessionCatalog().alterView(ident, changes);
}
throw new UnsupportedOperationException(
"Altering a view is not supported by catalog: " + catalogName);
}
@Override
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)) {View on GitHub (pinned to 86d9c8fc54)