apache/iceberg · error

missingCatalogAbilityError(plugin, "views")

Error message

missingCatalogAbilityError(plugin, "views")

What it means

Spark analysis error raised when a catalog plugin is used in a view operation (CREATE/REPLACE VIEW etc. handled by Iceberg's extensions) but the catalog does not implement ViewCatalog. ViewUtil's IcebergViewHelper.asViewCatalog inspects the resolved CatalogPlugin and throws QueryCompilationErrors.missingCatalogAbilityError(plugin, "views") when the cast to ViewCatalog is impossible. It means the chosen catalog cannot store views, so the view command cannot proceed.

Source

Thrown at spark/v3.5/spark-extensions/src/main/scala/org/apache/spark/sql/catalyst/analysis/ViewUtil.scala:47

    case viewCatalog: ViewCatalog =>
      try {
        Option(viewCatalog.loadView(ident))
      } catch {
        case _: NoSuchViewException => None
      }
    case _ => None
  }

  def isViewCatalog(catalog: CatalogPlugin): Boolean = {
    catalog.isInstanceOf[ViewCatalog]
  }

  implicit class IcebergViewHelper(plugin: CatalogPlugin) {
    def asViewCatalog: ViewCatalog = plugin match {
      case viewCatalog: ViewCatalog =>
        viewCatalog
      case _ =>
        throw QueryCompilationErrors.missingCatalogAbilityError(plugin, "views")
    }
  }
}

View on GitHub (pinned to 86d9c8fc54)

Solutions

  1. Set the command's catalog to one that implements ViewCatalog (e.g. an Iceberg REST catalog with view support) via USE <catalog> or a fully qualified catalog.database.view name.
  2. Check the catalog implementation registered in spark.sql.catalog.<name> — switch it to an Iceberg catalog version that supports views.
  3. If the session catalog (spark_catalog) is required for tables, keep view DDL on a separate ViewCatalog-capable catalog.
  4. Upgrade the Iceberg runtime/catalog implementation if it predates view support.

Example fix

// before (catalog does not support views)
CREATE VIEW prod.events_view AS SELECT * FROM prod.events;
// after
USE prod_catalog; -- ViewCatalog-backed REST catalog
CREATE VIEW prod.events_view AS SELECT * FROM prod.events;
Defensive patterns

Strategy: validation

Validate before calling

CatalogPlugin catalog = ...; // resolved catalog for the view command
if (!(catalog instanceof ViewCatalog)) {
  throw new IllegalArgumentException("Catalog " + catalog.name() + " does not support views; use a ViewCatalog-backed catalog");
}

Type guard

def supportsViews(catalog: CatalogPlugin): Boolean = catalog match {
  case _: ViewCatalog => true
  case _ => false
}

Try / catch

try {
  spark.sql("CREATE VIEW prod_catalog.db.v AS SELECT ...")
} catch {
  case e: AnalysisException if e.getMessage.contains("doesn't support views") ||
      e.getMessage.contains("view") =>
    // switch to a ViewCatalog-capable catalog and retry
}

Prevention

When it happens

Trigger: Executing CREATE VIEW / REPLACE VIEW / DROP VIEW (via Iceberg spark-extensions resolution) against a catalog that only implements TableCatalog — e.g. spark_catalog (the session catalog), a REST/Hive catalog version lacking view support, or the default file catalog — instead of a ViewCatalog implementation.

Common situations: Running CREATE VIEW ... USING iceberg or plain view DDL where the current catalog is HadoopCatalog/session catalog; mixing catalogs where views were created under an Iceberg REST catalog but a migration points at HiveCatalog; Spark versions where the configured catalog build lacks 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


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