apache/iceberg · error · UnsupportedOperationException
Creating a view is not supported by catalog: catalogName
Error message
Creating a view is not supported by catalog: catalogName
What it means
Thrown by SparkSessionCatalog.createView when neither the Iceberg view catalog nor the session catalog supports view creation (asViewCatalog is null and the session catalog cannot create views). View creation is a catalog capability; catalogs without ViewCatalog support reject CREATE VIEW explicitly with UnsupportedOperationException.
Source
Thrown at spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/SparkSessionCatalog.java:495
queryColumnNames,
columnAliases,
columnComments,
properties);
} else if (isViewCatalog()) {
return getSessionCatalog()
.createView(
ident,
sql,
currentCatalog,
currentNamespace,
schema,
queryColumnNames,
columnAliases,
columnComments,
properties);
}
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)
Solutions
- Configure a catalog implementation that implements ViewCatalog (HiveCatalog, REST catalog with views, JDBC with view support).
- Create the view in a catalog that supports it rather than the session catalog.
- Upgrade the Iceberg runtime if the target catalog added view support in a newer version.
- As a fallback, use Spark's temporary/global temp views (not persisted) for non-catalog view needs.
Example fix
// before
spark.conf.set("spark.sql.catalog.local", "org.apache.iceberg.hadoop.HadoopCatalog");
spark.sql("CREATE VIEW local.db.v AS SELECT ..."); // fails
// after
spark.conf.set("spark.sql.catalog.local", "org.apache.iceberg.hive.HiveCatalog"); // ViewCatalog
spark.sql("CREATE VIEW local.db.v AS SELECT ..."); Defensive patterns
Strategy: validation
Validate before calling
if (!(catalog instanceof ViewCatalog) && !sessionSupportsViewCreate()) { throw new IllegalStateException("view creation unsupported by this catalog"); } Type guard
boolean canCreateViews = (catalog instanceof ViewCatalog);
Try / catch
try { catalog.createView(ident, sql, ...); } catch (UnsupportedOperationException e) { /* create temp view or switch catalogs */ } Prevention
- Provision view-capable catalogs for environments that run CREATE VIEW
- Feature-detect ViewCatalog before issuing DDL
- Align catalog implementations across dev/prod
When it happens
Trigger: Running CREATE VIEW against a SparkSessionCatalog configured with a delegate that is not a view catalog and with asViewCatalog == null; also reached when session-catalog delegation path cannot handle view creation for the given options.
Common situations: Iceberg versions or catalog impls (HadoopCatalog, JDBC before view support) lacking ViewCatalog; CREATE VIEW routed to the session catalog on a setup where views aren't supported; mixing environments where dev supports views but prod catalog does not.
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
- Replacing 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}
- Altering a view is not supported by catalog: ${catalogName}
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/3b915467b89a2acf.
Report an issue: GitHub.