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 SparkCatalog.createView when the catalog the statement runs against does not implement ViewCatalog (asViewCatalog is null or viewInfo is null). Iceberg reports that view creation is simply not supported by this catalog. This is a capability gap, not a naming or permission problem.

Source

Thrown at spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java:648

        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)

Solutions

  1. Configure the catalog with a ViewCatalog-backed implementation (RESTCatalog, HiveCatalog, JdbcCatalog, Nessie)
  2. Check the error message's catalog name against your spark.sql.catalog.<name> settings
  3. Materialize results as a table instead of a view if the catalog cannot support views
  4. Upgrade Iceberg if the underlying catalog recently gained view support

Example fix

// before
// HadoopCatalog-backed 'prod': CREATE VIEW prod.db.v AS ... -> Creating a view is not supported by catalog: prod
// after
spark.conf.set("spark.sql.catalog.prod.catalog-impl", "org.apache.iceberg.rest.RESTCatalog")
spark.sql("CREATE VIEW prod.db.v AS SELECT ...")
Defensive patterns

Strategy: type-guard

Validate before calling

if (!(catalog instanceof ViewCatalog)) {
  throw new IllegalStateException("Catalog " + name + " cannot create views; switch to a ViewCatalog-backed impl");
}

Type guard

boolean catalogSupportsViewCreation(Catalog catalog) {
  return catalog instanceof SparkCatalog
      && ((SparkCatalog) catalog).viewExists(Identifier.of(new String[]{""}, "__probe__")) || catalogHasViewApi(catalog);
}

Try / catch

try {
  spark.sql("CREATE VIEW " + ident + " AS " + sql);
} catch (UnsupportedOperationException e) {
  if (e.getMessage().contains("not supported by catalog")) {
    throw new ConfigurationException("Reconfigure spark.sql.catalog." + name + ".catalog-impl to a ViewCatalog implementation");
  }
  throw e;
}

Prevention

When it happens

Trigger: CREATE VIEW issued against a catalog without view support (e.g. SparkCatalog wrapping HadoopCatalog or a custom TableCatalog); programmatic createView on such a catalog.

Common situations: Older catalog plugins (Hadoop catalog, S3FileIO-only setups) without ViewCatalog; mistyped catalog-impl; teams migrating from table-only catalogs expecting view parity.

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


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/94f9d6e636b85a87. Report an issue: GitHub.