{"record":{"id":"87e5ef8e2b53284a","repo":"apache/iceberg","slug":"creating-a-view-is-not-supported-by-catalog-cat-87e5ef","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.0/spark/src/main/java/org/apache/iceberg/spark/SparkSessionCatalog.java","lineNumber":472,"sourceCode":"    }\n\n    throw new NoSuchViewException(ident);\n  }\n\n  @Override\n  public View createView(ViewInfo viewInfo)\n      throws ViewAlreadyExistsException, NoSuchNamespaceException {\n    if (viewInfo == null) {\n      return null;\n    }\n\n    if (null != asViewCatalog) {\n      return asViewCatalog.createView(viewInfo);\n    } else if (isViewCatalog()) {\n      return getSessionCatalog().createView(viewInfo);\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 (asViewCatalog instanceof SupportsReplaceView) {\n      return ((SupportsReplaceView) asViewCatalog)\n          .replaceView(","sourceCodeStart":454,"sourceCodeEnd":490,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/SparkSessionCatalog.java#L454-L490","documentation":"Thrown by SparkSessionCatalog.createView when no underlying catalog supports view creation: there is no Iceberg ViewCatalog (asViewCatalog is null) and the session catalog is not a view catalog. View support is optional; catalogs without it must reject view DDL.","triggerScenarios":"Executing CREATE VIEW against a session catalog whose delegate does not implement ViewCatalog and where no Iceberg view catalog is registered.","commonSituations":"Using an older Iceberg version or a delegate catalog (e.g. simple Hive or in-memory catalog) without view support; user expects CREATE VIEW to work after registering SparkSessionCatalog.","solutions":["Register a catalog that supports views (Iceberg ViewCatalog, e.g. REST/Hive catalog with view support) and route the DDL to it.","Upgrade Iceberg if the delegate catalog's view support exists in a newer version.","Avoid CREATE VIEW against this catalog; store views in a catalog that supports them."],"exampleFix":"// before\nCREATE VIEW spark_catalog.db.v AS SELECT ...  // unsupported delegate\n// after\nCREATE VIEW iceberg_catalog.db.v AS SELECT ...  // catalog with view support","handlingStrategy":"type-guard","validationCode":"boolean viewSupported = (catalog instanceof SparkSessionCatalog<?> sc) /* delegate is ViewCatalog */;","typeGuard":"boolean supportsCreateView(Catalog catalog) {\n  return catalog instanceof ViewCatalog;\n}","tryCatchPattern":"try { catalog.createView(viewInfo); } catch (UnsupportedOperationException e) { /* fall back to a view-capable catalog */ }","preventionTips":["Check ViewCatalog support on the target catalog before issuing CREATE VIEW.","Register an Iceberg REST/Hive catalog with view support for view workloads.","Keep view DDL away from table-only session catalog delegates."],"tags":["spark","views","unsupported-operation","catalog"],"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"}