apache/iceberg · error · UnsupportedOperationException

Altering a view is not supported by catalog:

Error message

Altering a view is not supported by catalog: 

What it means

alterView in SparkSessionCatalog throws UnsupportedOperationException when no view-capable catalog exists to apply the ViewChange operations. View alteration is only supported when the delegate or session catalog implements ViewCatalog.

Solutions

  1. Register a view-capable catalog and run ALTER VIEW against it
  2. Drop and recreate the view with the desired definition/properties in a supported catalog
  3. Apply the change directly through the underlying metastore/catalog API

Example fix

// before
spark.sql("ALTER VIEW iceberg.db.v AS SELECT ..."); // no view support
// after
spark.sql("DROP VIEW IF EXISTS spark_catalog.db.v");
spark.sql("CREATE VIEW spark_catalog.db.v AS SELECT ...");
Defensive patterns

Strategy: fallback

Type guard

boolean supportsViewAlter(Catalog c) { return c instanceof ViewCatalog; }

Try / catch

try {
  catalog.alterView(ident, changes);
} catch (UnsupportedOperationException e) {
  // recreate the view with the new definition instead
}

Prevention

When it happens

Trigger: Running ALTER VIEW ... SET TBLPROPERTIES / AS SELECT against a catalog whose delegate lacks ViewCatalog; asViewCatalog is null and isViewCatalog() is false.

Common situations: Altering views on legacy catalogs that never implemented view APIs; wrong catalog resolution sending ALTER VIEW to an Iceberg table-only catalog; tools that unconditionally emit ALTER VIEW.

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/2c6b5517027d3b9a. Report an issue: GitHub.

Appendix: source

Thrown at spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/SparkSessionCatalog.java:556

              columnAliases,
              columnComments,
              properties);
    }

    throw new UnsupportedOperationException(
        "Replacing a view is not supported by catalog: " + catalogName);
  }

  @Override
  public View alterView(Identifier ident, ViewChange... changes)
      throws NoSuchViewException, IllegalArgumentException {
    if (null != asViewCatalog && asViewCatalog.viewExists(ident)) {
      return asViewCatalog.alterView(ident, changes);
    } else if (isViewCatalog()) {
      return getSessionCatalog().alterView(ident, changes);
    }

    throw new UnsupportedOperationException(
        "Altering 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 {
    if (null != asViewCatalog && asViewCatalog.viewExists(fromIdentifier)) {

View on GitHub (pinned to 86d9c8fc54)