{"record":{"id":"ed8f04830b07b735","repo":"apache/iceberg","slug":"renaming-a-view-is-not-supported-by-catalog-catal","errorCode":null,"errorMessage":"Renaming a view is not supported by catalog: catalogName","messagePattern":"Renaming a view is not supported by catalog: catalogName","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java","lineNumber":760,"sourceCode":"      return asViewCatalog.dropView(buildIdentifier(ident));\n    }\n\n    return false;\n  }\n\n  @Override\n  public void renameView(Identifier fromIdentifier, Identifier toIdentifier)\n      throws NoSuchViewException, ViewAlreadyExistsException {\n    if (null != asViewCatalog) {\n      try {\n        asViewCatalog.renameView(buildIdentifier(fromIdentifier), buildIdentifier(toIdentifier));\n      } catch (org.apache.iceberg.exceptions.NoSuchViewException e) {\n        throw new NoSuchViewException(fromIdentifier);\n      } catch (org.apache.iceberg.exceptions.AlreadyExistsException e) {\n        throw new ViewAlreadyExistsException(toIdentifier);\n      }\n    } else {\n      throw new UnsupportedOperationException(\n          \"Renaming a view is not supported by catalog: \" + catalogName);\n    }\n  }\n\n  @Override\n  public final void initialize(String name, CaseInsensitiveStringMap options) {\n    super.initialize(name, options);\n\n    this.cacheEnabled =\n        PropertyUtil.propertyAsBoolean(\n            options, CatalogProperties.CACHE_ENABLED, CatalogProperties.CACHE_ENABLED_DEFAULT);\n\n    boolean cacheCaseSensitive =\n        PropertyUtil.propertyAsBoolean(\n            options,\n            CatalogProperties.CACHE_CASE_SENSITIVE,\n            CatalogProperties.CACHE_CASE_SENSITIVE_DEFAULT);\n","sourceCodeStart":742,"sourceCodeEnd":778,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java#L742-L778","documentation":"Thrown by SparkCatalog.renameView when the configured catalog does not implement ViewCatalog (asViewCatalog is null), so view renames are impossible. This is an explicit capability error: the catalog only supports tables or lacks view support.","triggerScenarios":"Calling ALTER VIEW RENAME (or SparkCatalog.renameView) on a catalog registered as spark.catalog that is not a ViewCatalog, e.g. HadoopCatalog, a plain TableCatalog, or older Iceberg catalogs without view support.","commonSituations":"Clusters configured with an Iceberg catalog version/implementation predating ViewCatalog support; using a session catalog that only handles tables; running the same SQL across environments where one env uses a non-view catalog.","solutions":["Use a catalog implementation that implements ViewCatalog (e.g. HiveCatalog, REST catalog with view support, JDBC catalog).","Update the Iceberg runtime version if the configured catalog should support views but the class predates ViewCatalog.","Drop and recreate the view under the new name manually as a workaround.","Check spark.sql.catalog.<name> points to the intended catalog class."],"exampleFix":"// before\nspark.conf.set(\"spark.sql.catalog.local\", \"org.apache.iceberg.spark.SparkCatalog\");\n// after\nspark.conf.set(\"spark.sql.catalog.local\", \"org.apache.iceberg.hive.HiveCatalog\"); // or REST catalog implementing ViewCatalog","handlingStrategy":"validation","validationCode":"if (!(catalog instanceof ViewCatalog)) { throw new IllegalStateException(\"catalog does not support views: \" + catalog.name()); }","typeGuard":"boolean viewRenameSupported = (catalog instanceof ViewCatalog);","tryCatchPattern":"try { catalog.renameView(from, to); } catch (UnsupportedOperationException e) { /* fall back to drop+create or use a view-capable catalog */ }","preventionTips":["Verify the catalog class implements ViewCatalog at setup","Pin environments to catalogs with identical capabilities","Check Iceberg runtime version supports views for your catalog"],"tags":["spark","view","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"}