apache/iceberg · error · UnsupportedOperationException
Registering views is not supported
Error message
Registering views is not supported
What it means
ViewSessionCatalog is the SessionCatalog variant of ViewCatalog; its registerView default method throws UnsupportedOperationException because session-aware catalog wrappers are not required to support registering views from metadata files. Only implementations that explicitly override it will work.
Source
Thrown at api/src/main/java/org/apache/iceberg/catalog/ViewSessionCatalog.java:137
* not cached, do nothing.
*
* @param identifier a view identifier
*/
default void invalidateView(SessionCatalog.SessionContext context, TableIdentifier identifier) {}
/**
* Register a view if it does not exist.
*
* @param context session context
* @param ident a view identifier
* @param metadataFileLocation the location of a metadata file
* @return a View instance
* @throws AlreadyExistsException if a table/view with the same identifier already exists in the
* catalog.
*/
default View registerView(
SessionCatalog.SessionContext context, TableIdentifier ident, String metadataFileLocation) {
throw new UnsupportedOperationException("Registering views is not supported");
}
/**
* Initialize a view catalog given a custom name and a map of catalog properties.
*
* <p>A custom view catalog implementation must have a no-arg constructor. A compute engine like
* Spark or Flink will first initialize the catalog without any arguments, and then call this
* method to complete catalog initialization with properties passed into the engine.
*
* @param name a custom name for the catalog
* @param properties catalog properties
*/
void initialize(String name, Map<String, String> properties);
}
View on GitHub (pinned to 86d9c8fc54)
Solutions
- Bypass the session wrapper and call registerView directly on the underlying ViewCatalog if it supports view registration.
- Recreate the view in the target catalog with createView instead of registering its metadata file.
- Upgrade the catalog implementation to a version that implements registerView.
- Wrap the call in try-catch for UnsupportedOperationException and report that view registration is unavailable for this catalog.
- Implement registerView in the custom session catalog, delegating to the inner catalog.
Example fix
// before
View view = sessionCatalog.registerView(context, ident, metadataLocation);
// after
View view;
try {
view = sessionCatalog.registerView(context, ident, metadataLocation);
} catch (UnsupportedOperationException e) {
throw new IllegalArgumentException(
"Catalog " + name + " does not support registering views; recreate the view instead", e);
} Defensive patterns
Strategy: try-catch
Validate before calling
boolean supports = !(catalog.getClass().getName().contains("HiveCatalog")); // or consult docs
catalog.views().forEach(v -> System.out.println(v.name())); // catalog must at least implement ViewCatalog Type guard
boolean supportsViewRegistration(Catalog catalog) {
return !(catalog instanceof ViewCatalog) ? false
: !catalog.getClass().get superclass. getMethod("registerView", TableIdentifier.class, String.class)
.getDeclaringClass().isInterface();
} Try / catch
try {
view = catalog.registerView(ident, metadataLocation);
} catch (UnsupportedOperationException e) {
throw new UnsupportedOperationException(
"View registration is not supported by " + catalog.name(), e);
} Prevention
- Check the catalog implementation's docs before assuming registerView works.
- Prefer createView-based migration over metadata-file registration when unsure.
- Feature-test the method via reflection in generic tooling.
- Keep catalog implementations upgraded to versions that implement registerView.
When it happens
Trigger: Calling sessionCatalog.registerView(context, ident, metadataFileLocation) (typically via CatalogManager/Spark session catalog dispatch) against a wrapped catalog that does not override the method.
Common situations: Registering an existing view's metadata file through a session-aware catalog path (e.g., Spark 4 session catalog adapters) where the underlying catalog lacks registerView; code paths shared with table registration that assume parity between registerTable and registerView.
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
- Registering views is not supported
- 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}
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/3a2d25c9d2cc7cf4.
Report an issue: GitHub.