apache/iceberg · error · UnsupportedOperationException
Creating or replacing a view is not supported by catalog: ${
Error message
Creating or replacing a view is not supported by catalog: ${catalogName} What it means
SparkSessionCatalog delegates view DDL to the session catalog when it implements ViewCatalog. If neither the asViewCatalog view catalog nor the session catalog supports views, createOrReplaceView throws this UnsupportedOperationException. It signals the configured catalog cannot manage views at all.
Source
Thrown at spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/SparkSessionCatalog.java:626
throw new NoSuchViewException(ident);
}
@Override
public View createOrReplaceView(Identifier ident, View view)
throws ViewAlreadyExistsException, NoSuchNamespaceException {
checkTableNotExists(ident);
if (null != asViewCatalog && asViewCatalog.viewExists(ident)) {
return asViewCatalog.createOrReplaceView(ident, view);
} else if (isViewCatalog() && getSessionCatalog().viewExists(ident)) {
return getSessionCatalog().createOrReplaceView(ident, view);
} else if (null != asViewCatalog) {
return asViewCatalog.createOrReplaceView(ident, view);
} else if (isViewCatalog()) {
return getSessionCatalog().createOrReplaceView(ident, view);
}
throw new UnsupportedOperationException(
"Creating or replacing 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 {
checkTableNotExists(toIdentifier);View on GitHub (pinned to 86d9c8fc54)
Solutions
- Configure the catalog so it implements ViewCatalog (e.g. use a Hive or JDBC catalog with view support)
- Pass a dedicated view catalog via asViewCatalog / catalog configuration so view DDL is delegated
- Create the view through Spark SQL against a view-capable catalog instead of the Iceberg API
- Use createView or table-only workflows if view management is genuinely not needed
Example fix
// before
spark.sql("CREATE OR REPLACE VIEW unsupported_cat.db.v AS SELECT 1") // throws
// after
spark.conf.set("spark.sql.catalog.mycat", "org.apache.iceberg.spark.SparkCatalog")
spark.conf.set("spark.sql.catalog.mycat.catalog-impl", "org.apache.iceberg.jdbc.JdbcCatalog") // view-capable session catalog Defensive patterns
Strategy: type-guard
Validate before calling
boolean supportsViews = catalog instanceof org.apache.iceberg.view.ViewCatalog;
Type guard
if (!(catalog instanceof org.apache.iceberg.view.ViewCatalog)) {
throw new IllegalStateException("Catalog does not support views: " + catalog.name());
} Try / catch
try {
catalog.createOrReplaceView(ident, view);
} catch (UnsupportedOperationException e) {
// route view DDL to a view-capable catalog or fail fast with a clear message
} Prevention
- Choose catalog implementations with ViewCatalog support when views are required
- Smoke-test view DDL (CREATE VIEW) during catalog onboarding
- Keep view and table catalogs clearly separated in Spark conf
- Document which catalogs in your stack support views
When it happens
Trigger: Calling catalog.createOrReplaceView(ident, view) on a SparkCatalog/SparkSessionCatalog whose session catalog does not implement ViewCatalog and no separate view catalog was injected.
Common situations: Using a catalog (e.g. HadoopCatalog or a plain table-only catalog) that never supported views; forgetting to configure a view-capable catalog like JDBC/Hive; Spark version/catalog misconfiguration where view support isn't wired.
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
- 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}
- Renaming a view is not supported by catalog: ${catalogName}
- Renaming a view is not supported by catalog: ${catalogName}
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/2acc93da842a46bd.
Report an issue: GitHub.