{"record":{"id":"94f9d6e636b85a87","repo":"apache/iceberg","slug":"creating-a-view-is-not-supported-by-catalog-cat-94f9d6","errorCode":null,"errorMessage":"Creating a view is not supported by catalog: ${catalogName}","messagePattern":"Creating a view is not supported by catalog: (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java","lineNumber":648,"sourceCode":"        org.apache.iceberg.view.View view =\n            asViewCatalog\n                .buildView(buildIdentifier(ident))\n                .withDefaultCatalog(currentCatalog)\n                .withDefaultNamespace(Namespace.of(currentNamespace))\n                .withQuery(\"spark\", sql)\n                .withSchema(icebergSchema)\n                .withLocation(properties.get(\"location\"))\n                .withProperties(props)\n                .create();\n        return new SparkView(catalogName, view);\n      } catch (org.apache.iceberg.exceptions.NoSuchNamespaceException e) {\n        throw new NoSuchNamespaceException(currentNamespace);\n      } catch (AlreadyExistsException e) {\n        throw new ViewAlreadyExistsException(ident);\n      }\n    }\n\n    throw new UnsupportedOperationException(\n        \"Creating a view is not supported by catalog: \" + catalogName);\n  }\n\n  @Override\n  public View replaceView(\n      Identifier ident,\n      String sql,\n      String currentCatalog,\n      String[] currentNamespace,\n      StructType schema,\n      String[] queryColumnNames,\n      String[] columnAliases,\n      String[] columnComments,\n      Map<String, String> properties)\n      throws NoSuchNamespaceException, NoSuchViewException {\n    if (null != asViewCatalog) {\n      Schema icebergSchema = SparkSchemaUtil.convert(schema);\n","sourceCodeStart":630,"sourceCodeEnd":666,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java#L630-L666","documentation":"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.","triggerScenarios":"CREATE VIEW issued against a catalog without view support (e.g. SparkCatalog wrapping HadoopCatalog or a custom TableCatalog); programmatic createView on such a catalog.","commonSituations":"Older catalog plugins (Hadoop catalog, S3FileIO-only setups) without ViewCatalog; mistyped catalog-impl; teams migrating from table-only catalogs expecting view parity.","solutions":["Configure the catalog with a ViewCatalog-backed implementation (RESTCatalog, HiveCatalog, JdbcCatalog, Nessie)","Check the error message's catalog name against your spark.sql.catalog.<name> settings","Materialize results as a table instead of a view if the catalog cannot support views","Upgrade Iceberg if the underlying catalog recently gained view support"],"exampleFix":"// before\n// HadoopCatalog-backed 'prod': CREATE VIEW prod.db.v AS ... -> Creating a view is not supported by catalog: prod\n// after\nspark.conf.set(\"spark.sql.catalog.prod.catalog-impl\", \"org.apache.iceberg.rest.RESTCatalog\")\nspark.sql(\"CREATE VIEW prod.db.v AS SELECT ...\")","handlingStrategy":"type-guard","validationCode":"if (!(catalog instanceof ViewCatalog)) {\n  throw new IllegalStateException(\"Catalog \" + name + \" cannot create views; switch to a ViewCatalog-backed impl\");\n}","typeGuard":"boolean catalogSupportsViewCreation(Catalog catalog) {\n  return catalog instanceof SparkCatalog\n      && ((SparkCatalog) catalog).viewExists(Identifier.of(new String[]{\"\"}, \"__probe__\")) || catalogHasViewApi(catalog);\n}","tryCatchPattern":"try {\n  spark.sql(\"CREATE VIEW \" + ident + \" AS \" + sql);\n} catch (UnsupportedOperationException e) {\n  if (e.getMessage().contains(\"not supported by catalog\")) {\n    throw new ConfigurationException(\"Reconfigure spark.sql.catalog.\" + name + \".catalog-impl to a ViewCatalog implementation\");\n  }\n  throw e;\n}","preventionTips":["Add a startup capability probe that asserts view support for catalogs used by view code","Avoid HadoopCatalog/table-only wrappers in view-heavy workloads","Keep catalog-impl settings reviewed in code, not ad-hoc session config","Test view DDL against each environment's catalog configuration"],"tags":["spark","view","unsupported-operation","catalog-capability"],"backgroundTag":"unsupported-operation","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}