{"record":{"id":"7888f60690e47c56","repo":"apache/iceberg","slug":"renaming-a-view-is-not-supported-by-catalog-cat-7888f6","errorCode":null,"errorMessage":"Renaming a view is not supported by catalog: ${catalogName}","messagePattern":"Renaming a view is not supported by catalog: (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java","lineNumber":787,"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    boolean 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":769,"sourceCodeEnd":805,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java#L769-L805","documentation":"UnsupportedOperationException raised by SparkCatalog.renameView when the wrapped catalog does not implement the ViewCatalog interface (asViewCatalog is null). Spark cannot rename views through a catalog that only supports tables, so the operation is rejected with a message naming the catalog.","triggerScenarios":"ALTER VIEW ... RENAME TO ... executed against a SparkCatalog whose underlying org.apache.iceberg.catalog.Catalog is not a ViewCatalog (e.g., HadoopCatalog or a custom catalog without view support).","commonSituations":"Using HadoopCatalog/HadoopTables-style catalogs that never supported views; older custom catalog implementations; running view DDL against a catalog registered without view capability.","solutions":["Switch to a catalog implementation that implements ViewCatalog (HiveCatalog, JDBC Catalog, REST Catalog, Nessie, etc.)","Avoid view DDL against this catalog and manage views elsewhere","Upgrade the custom catalog implementation to add ViewCatalog support"],"exampleFix":"// before\nspark.conf.set(\"spark.sql.catalog.local\", \"org.apache.iceberg.spark.SparkCatalog\")\nspark.conf.set(\"spark.sql.catalog.local.catalog-impl\", \"org.apache.iceberg.hadoop.HadoopCatalog\")\n// ALTER VIEW local.db.v RENAME TO ... fails\n// after\nspark.conf.set(\"spark.sql.catalog.local.catalog-impl\", \"org.apache.iceberg.jdbc.JdbcCatalog\") // ViewCatalog-capable","handlingStrategy":"type-guard","validationCode":"// before view DDL, ensure the catalog supports views\nif (!(icebergCatalog instanceof org.apache.iceberg.view.ViewCatalog)) {\n  throw new UnsupportedOperationException(\"Catalog does not support views\");\n}","typeGuard":"boolean supportsViews = icebergCatalog instanceof org.apache.iceberg.view.ViewCatalog;","tryCatchPattern":"try {\n  catalog.renameView(fromIdent, toIdent);\n} catch (UnsupportedOperationException e) {\n  // switch catalog or skip view operations\n}","preventionTips":["Choose ViewCatalog implementations (Hive, JDBC, REST, Nessie) when views are needed","Verify catalog capability at setup time, not at first DDL","Keep view workloads on catalogs documented to support views"],"tags":["spark","view","rename","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"}