{"record":{"id":"4ba9f08a0874b2ec","repo":"apache/iceberg","slug":"missingcatalogviewsabilityerror-plugin-4ba9f0","errorCode":null,"errorMessage":"missingCatalogViewsAbilityError(plugin)","messagePattern":"missingCatalogViewsAbilityError\\(plugin\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"spark/v4.2/spark/src/main/scala/org/apache/spark/sql/catalyst/analysis/ViewUtil.scala","lineNumber":90,"sourceCode":"      case _ =>\n        None\n    }\n\n  def isIcebergViewCatalog(catalog: CatalogPlugin): Boolean = {\n    catalog.isInstanceOf[ViewCatalog] && catalog.isInstanceOf[HasIcebergCatalog]\n  }\n\n  private def isIcebergView(view: View): Boolean = {\n    !view.isInstanceOf[V1View] &&\n    \"iceberg\".equalsIgnoreCase(view.properties.get(TableCatalog.PROP_PROVIDER))\n  }\n\n  implicit class IcebergViewHelper(plugin: CatalogPlugin) {\n    def asViewCatalog: ViewCatalog = plugin match {\n      case viewCatalog: ViewCatalog =>\n        viewCatalog\n      case _ =>\n        throw QueryCompilationErrors.missingCatalogViewsAbilityError(plugin)\n    }\n  }\n}\n","sourceCodeStart":72,"sourceCodeEnd":94,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.2/spark/src/main/scala/org/apache/spark/sql/catalyst/analysis/ViewUtil.scala#L72-L94","documentation":"In the Spark 4.2 main source tree, ViewUtil's IcebergViewHelper.asViewCatalog throws missingCatalogViewsAbilityError when the CatalogPlugin does not implement ViewCatalog. It is the type-narrowing guard for all view operations routed through Iceberg's extended analysis: view commands must land on a view-capable catalog.","triggerScenarios":"Any view command (CREATE/ALTER/DROP/SHOW VIEW) resolved to a catalog that implements CatalogPlugin but not ViewCatalog, so the implicit asViewCatalog conversion fails.","commonSituations":"Default session catalog without view support receiving view DDL; catalog registered only for tables; catalog implementation version lacking view support while Spark expects it.","solutions":["Use a ViewCatalog implementation for view operations (REST, Hive, or another view-capable catalog)","Qualify the view name with the correct catalog so resolution does not fall back to a non-view catalog","Upgrade the catalog implementation to a version supporting views","Move view definitions to the session catalog if the target cannot hold views"],"exampleFix":"-- before\nCREATE VIEW table_only_catalog.db.v AS SELECT 1;\n-- after\nCREATE VIEW rest_catalog.db.v AS SELECT 1; -- RESTCatalog implements ViewCatalog","handlingStrategy":"validation","validationCode":"def supportsViews(c: CatalogPlugin): Boolean = c.isInstanceOf[ViewCatalog]\nassert(supportsViews(catalogManager.currentCatalog), \"current catalog cannot store views\")","typeGuard":"def viewCatalogOrNull(plugin: CatalogPlugin): ViewCatalog =\n  if (plugin.isInstanceOf[ViewCatalog]) plugin.asInstanceOf[ViewCatalog] else null","tryCatchPattern":null,"preventionTips":["Pin view workloads to view-capable catalogs in configuration","Test catalog capability once at job startup, not per statement"],"tags":["spark","catalog","views"],"backgroundTag":"unsupported-operation","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}