{"record":{"id":"ee4a775c4c42f006","repo":"apache/iceberg","slug":"view-not-found-fromidentifier","errorCode":null,"errorMessage":"View not found: ${fromIdentifier}","messagePattern":"View not found: (.+?)","errorType":"exception","errorClass":"NoSuchViewException","httpStatus":null,"severity":"error","filePath":"spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java","lineNumber":758,"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":740,"sourceCodeEnd":776,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java#L740-L776","documentation":"renameView() translates a core NoSuchViewException from ViewCatalog.renameView into a Spark NoSuchViewException naming the source identifier. It means the FROM view of the rename does not exist in the catalog. The TO name may be fine; only the source lookup failed.","triggerScenarios":"Calling SparkCatalog.renameView(fromIdentifier, toIdentifier) (ALTER VIEW ... RENAME TO) when the catalog throws org.apache.iceberg.exceptions.NoSuchViewException for buildIdentifier(fromIdentifier).","commonSituations":"Misspelled or stale view name in migration scripts; view dropped concurrently by another job; rename issued against a namespace where the view was never created; case mismatch on name-sensitive catalogs.","solutions":["Confirm the source view exists (SHOW VIEWS / listViews) using the exact namespace and name","Fix the fromIdentifier spelling/case or the default namespace in the Spark session","Recreate the view if it was dropped before retrying the rename"],"exampleFix":"// before\nspark.sql(\"ALTER VIEW analytics.daly_rev RENAME TO analytics.daily_revenue\");\n// after\nspark.sql(\"ALTER VIEW analytics.daily_rev RENAME TO analytics.daily_revenue\");","handlingStrategy":"try-catch","validationCode":"// Ensure source view exists before renaming\nboolean exists = ((org.apache.iceberg.catalog.ViewCatalog) catalog)\n    .viewExists(org.apache.iceberg.catalog.TableIdentifier.of(fromNs, fromName));\nif (!exists) {\n  throw new IllegalStateException(\"Cannot rename: view \" + fromName + \" not found\");\n}","typeGuard":"boolean sourceExists(org.apache.iceberg.catalog.ViewCatalog vc, Identifier ident) {\n  try {\n    vc.loadView(org.apache.iceberg.catalog.TableIdentifier.of(ident.namespace().levels(), ident.name()));\n    return true;\n  } catch (org.apache.iceberg.exceptions.NoSuchViewException e) {\n    return false;\n  }\n}","tryCatchPattern":"try {\n  catalog.renameView(from, to);\n} catch (NoSuchViewException e) {\n  logger.error(\"Source view {} not found; verify namespace and name\", from, e);\n}","preventionTips":["List views in the source namespace before running rename migrations","Make migration scripts idempotent: skip the rename when the source is missing and the destination already exists","Use fully qualified identifiers instead of relying on the session default namespace"],"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"}