{"record":{"id":"4894660391cf020b","repo":"apache/iceberg","slug":"nosuchviewexception-fromidentifier-489466","errorCode":null,"errorMessage":"NoSuchViewException(fromIdentifier)","messagePattern":"NoSuchViewException\\(fromIdentifier\\)","errorType":"exception","errorClass":"NoSuchViewException","httpStatus":404,"severity":"error","filePath":"spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java","lineNumber":782,"sourceCode":"  }\n\n  @Override\n  public boolean dropView(Identifier ident) {\n    if (null != asViewCatalog) {\n      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 =","sourceCodeStart":764,"sourceCodeEnd":800,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java#L764-L800","documentation":"Thrown by SparkCatalog.renameView when the underlying Iceberg view catalog reports that the source view does not exist. Spark translates org.apache.iceberg.exceptions.NoSuchViewException into Spark's NoSuchViewException for the fromIdentifier, aborting the rename.","triggerScenarios":"ALTER VIEW from RENAME TO to (Spark 3.4+ / Iceberg view support) where fromIdentifier names no existing view in asViewCatalog.","commonSituations":"Renaming a view that was dropped; typos in the source name; wrong namespace; view exists in a different catalog than the one Spark is addressing.","solutions":["Verify the source view exists (SHOW VIEWS) before renaming","Correct the source identifier's namespace/name","Ensure the statement targets the catalog that actually holds the view"],"exampleFix":"// before\nALTER VIEW catalog.db.old_view RENAME TO catalog.db.new_view; // view missing\n// after\nCREATE OR REPLACE VIEW catalog.db.old_view AS SELECT 1; // recreate, then rename\nALTER VIEW catalog.db.old_view RENAME TO catalog.db.new_view;","handlingStrategy":"try-catch","validationCode":"if (!spark.catalog().viewExists(\"catalog\", \"db\", \"from\")) { throw new IllegalStateException(\"source view missing\"); }","typeGuard":null,"tryCatchPattern":"try {\n  catalog.renameView(fromIdent, toIdent);\n} catch (NoSuchViewException e) {\n  // handle missing source: recreate or abort\n}","preventionTips":["List views with SHOW VIEWS before rename operations","Pin the exact catalog in statements to avoid cross-catalog lookups","Guard migration scripts against already-renamed sources"],"tags":["spark","view","rename","not-found"],"backgroundTag":"entity-not-found","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"}