apache/iceberg · error · UnsupportedOperationException
Creating a view is not supported by catalog:
Error message
Creating a view is not supported by catalog:
What it means
createView in SparkSessionCatalog throws UnsupportedOperationException when no view-capable catalog is available: the delegate is not a ViewCatalog and the session catalog is not view-capable. Iceberg only proxies view creation when the underlying catalog implements Spark's ViewCatalog interface.
Solutions
- Configure a view-capable catalog (e.g. an Iceberg REST/Hive catalog registered with view support) and create the view there
- Create the view through Spark's session catalog (V2SessionCatalog) rather than the Iceberg catalog
- Upgrade the underlying catalog plugin to a version implementing ViewCatalog
Example fix
// before
spark.sql("CREATE VIEW iceberg.db.v AS SELECT ..."); // catalog lacks view support
// after
spark.sql("CREATE VIEW spark_catalog.db.v AS SELECT ..."); // session catalog supports views Defensive patterns
Strategy: fallback
Validate before calling
// only create views where the catalog implements ViewCatalog
if (catalog instanceof ViewCatalog) {
((ViewCatalog) catalog).createView(viewInfo);
} Type guard
boolean supportsViews(Catalog c) { return c instanceof ViewCatalog; } Try / catch
try {
catalog.createView(viewInfo);
} catch (UnsupportedOperationException e) {
// create the view in the session catalog instead
} Prevention
- Verify the target catalog advertises view support before emitting CREATE VIEW
- Keep view DDL in a catalog known to support Iceberg views (REST/Hive with views enabled)
When it happens
Trigger: Executing CREATE VIEW against a catalog whose delegate lacks ViewCatalog support; SparkSessionCatalog initialized with a table-only delegate; isViewCatalog() is false and asViewCatalog is null.
Common situations: Trying to create views in spark_catalog backed by a non-view session catalog; older Spark versions or catalog plugins without view support; expecting Iceberg to add view support that the underlying catalog does not have.
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: catalogName
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/342c571e240065c5.
Report an issue: GitHub.
Appendix: source
Thrown at spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/SparkSessionCatalog.java:513
}
throw new NoSuchViewException(ident);
}
@Override
public View createView(ViewInfo viewInfo)
throws ViewAlreadyExistsException, NoSuchNamespaceException {
if (viewInfo == null) {
return null;
}
if (null != asViewCatalog) {
return asViewCatalog.createView(viewInfo);
} else if (isViewCatalog()) {
return getSessionCatalog().createView(viewInfo);
}
throw new UnsupportedOperationException(
"Creating a view is not supported by catalog: " + catalogName);
}
@Override
public View replaceView(
Identifier ident,
String sql,
String currentCatalog,
String[] currentNamespace,
StructType schema,
String[] queryColumnNames,
String[] columnAliases,
String[] columnComments,
Map<String, String> properties)
throws NoSuchNamespaceException, NoSuchViewException {
if (asViewCatalog instanceof SupportsReplaceView) {
return ((SupportsReplaceView) asViewCatalog)
.replaceView(View on GitHub (pinned to 86d9c8fc54)