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

createView ends by throwing UnsupportedOperationException("Creating a view is not supported by catalog: " + catalogName) when the catalog wrapped by SparkCatalog does not implement ViewCatalog (asViewCatalog == null). The catalog simply has no view capability, so view creation cannot be performed.

Source

Thrown at spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java:644

        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. Use a view-capable catalog: upgrade Iceberg to >= 1.4 and configure a catalog impl that implements ViewCatalog (REST, JDBC, Hive, Nessie, etc.)
  2. Rewrite the workload to use tables or temp views (CREATE TEMP VIEW) if the catalog cannot be changed
  3. Check spark.sql.catalog.<name>.catalog-impl configuration points at the intended catalog class
  4. If views are genuinely unsupported in your storage backend, replace the view with a shared table

Example fix

// before
spark.sql.catalog.glue=org.apache.iceberg.spark.SparkCatalog
spark.sql.catalog.glue.catalog-impl=org.apache.iceberg.hadoop.HadoopCatalog // table-only
CREATE VIEW glue.db.v AS SELECT ...; // UnsupportedOperationException
// after
spark.sql.catalog.glue.catalog-impl=org.apache.iceberg.rest.RESTCatalog // ViewCatalog-capable
CREATE VIEW glue.db.v AS SELECT ...;
Defensive patterns

Strategy: type-guard

Validate before calling

// verify the catalog supports views before issuing CREATE VIEW
boolean viewCapable = spark.sessionState().catalogManager().catalog(catalogName)
    instanceof org.apache.iceberg.view.ViewCatalog;
if (!viewCapable) { /* use CREATE TEMP VIEW or change catalog */ }

Type guard

if (catalog instanceof org.apache.iceberg.view.ViewCatalog vc) {
  vc.buildView(Identifier.of(ns, name)).withSchema(schema).create();
} else {
  throw new UnsupportedOperationException(catalogName + " cannot store views");
}

Try / catch

try {
  spark.sql("CREATE VIEW " + ident + " AS SELECT ...;");
} catch (UnsupportedOperationException e) {
  // fall back to temp view or persistent table
  df.createOrReplaceTempView(name);
}

Prevention

When it happens

Trigger: CREATE VIEW against a SparkCatalog whose underlying catalog lacks ViewCatalog support (asViewCatalog == null) — always thrown regardless of the identifier.

Common situations: Older Iceberg versions (pre-1.4 / Spark < 3.4 integrations) without view support; custom catalog implementations that only implement TableCatalog; metastores (e.g. old HadoopCatalog configs) that cannot store views; session misconfiguration routing DDL to a table-only catalog.

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/8086c98f5dc5ef18. Report an issue: GitHub.