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
SparkCatalog.createView throws UnsupportedOperationException when the wrapped catalog does not implement the Iceberg ViewCatalog interface (asViewCatalog is null). Views are only supported by view-capable catalogs (Hive, JDBC, REST, Nessie, in-memory), so createView cannot proceed and reports the unsupported catalog name.
Solutions
- Switch spark.sql.catalog.<name> to a view-capable catalog implementation (HiveCatalog, JdbcCatalog, RESTCatalog, NessieCatalog, or SQL extensions' in-memory catalog).
- If views must live in Hadoop-style storage, use a catalog that implements ViewCatalog with a compatible backend.
- Avoid view DDL against this catalog; materialize results as an Iceberg table instead (CREATE TABLE AS SELECT).
- For custom catalogs, implement org.apache.iceberg.catalog.ViewCatalog to enable view operations.
Example fix
// before
spark.conf.set("spark.sql.catalog.local", "org.apache.iceberg.hadoop.HadoopCatalog");
spark.sql("CREATE VIEW local.ns.v AS SELECT 1"); // UnsupportedOperationException
// after
spark.conf.set("spark.sql.catalog.local", "org.apache.iceberg.jdbc.JdbcCatalog");
spark.sql("CREATE VIEW local.ns.v AS SELECT 1"); Defensive patterns
Strategy: validation
Validate before calling
Catalog catalog = Spark3Util.loadIcebergCatalog(spark, catalogName);
if (!(catalog instanceof ViewCatalog)) {
throw new IllegalStateException("Catalog " + catalogName + " does not support views");
} Type guard
boolean supportsViews(Catalog catalog) {
return catalog instanceof org.apache.iceberg.catalog.ViewCatalog;
} Try / catch
try {
spark.sql("CREATE VIEW " + ident + " AS " + sqlText);
} catch (UnsupportedOperationException e) {
if (e.getMessage().contains("Creating a view is not supported")) {
// fall back to CREATE TABLE AS SELECT or switch catalogs
}
} Prevention
- Check spark.sql.catalog.<name> implementation class supports ViewCatalog before running view DDL.
- Prefer HiveCatalog/JdbcCatalog/RESTCatalog/NessieCatalog for workloads with views.
- Add a session-startup assertion that required catalogs implement ViewCatalog.
- Keep catalog configuration in version-controlled configs so class changes are reviewed.
When it happens
Trigger: Executing CREATE VIEW (routed to createView at SparkCatalog.java:606) against spark.sql.catalog.<name> set to a table-only Iceberg catalog such as HadoopCatalog (spark.sql.catalog.<name>=org.apache.iceberg.hadoop.HadoopCatalog) or any custom Catalog implementation lacking ViewCatalog.
Common situations: Teams upgrading to Spark 3.4+ SQL view syntax while still on the Hadoop catalog; examples/tests that configure a HadoopCatalog then run view DDL; custom catalog implementations that never added ViewCatalog support.
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: catalogName
- Replacing a view is not supported by catalog: catalogName
- Altering a view is not supported by catalog:
- Altering a view is not supported by catalog
- Altering a view is not supported by catalog
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/0814922a142e8c6e.
Report an issue: GitHub.
Appendix: source
Thrown at spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java:645
org.apache.iceberg.view.View view =
asViewCatalog
.buildView(buildIdentifier(ident))
.withDefaultCatalog(currentCatalog)
.withDefaultNamespace(Namespace.of(currentNamespace))
.withQuery("spark", sql)
.withSchema(icebergSchema)
.withLocation(properties.get("location"))
.withProperties(props)
.create();
return new SparkView(catalogName, view);
} catch (org.apache.iceberg.exceptions.NoSuchNamespaceException e) {
throw new NoSuchNamespaceException(currentNamespace);
} catch (AlreadyExistsException e) {
throw new ViewAlreadyExistsException(ident);
}
}
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 (null != asViewCatalog) {
Schema icebergSchema = SparkSchemaUtil.convert(schema);
View on GitHub (pinned to 86d9c8fc54)