{"record":{"id":"3a3401425387aea2","repo":"apache/iceberg","slug":"view-not-found-ident-quoted","errorCode":null,"errorMessage":"View not found: ${ident.quoted}","messagePattern":"View not found: (.+?)","errorType":"exception","errorClass":"NoSuchViewException","httpStatus":null,"severity":"error","filePath":"spark/v4.2/spark-extensions/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DropV2ViewExec.scala","lineNumber":35,"sourceCode":" * under the License.\n */\npackage org.apache.spark.sql.execution.datasources.v2\n\nimport org.apache.spark.sql.catalyst.InternalRow\nimport org.apache.spark.sql.catalyst.analysis.NoSuchViewException\nimport org.apache.spark.sql.catalyst.expressions.Attribute\nimport org.apache.spark.sql.connector.catalog.Identifier\nimport org.apache.spark.sql.connector.catalog.ViewCatalog\n\ncase class DropV2ViewExec(catalog: ViewCatalog, ident: Identifier, ifExists: Boolean)\n    extends LeafV2CommandExec {\n\n  override lazy val output: Seq[Attribute] = Nil\n\n  override protected def run(): Seq[InternalRow] = {\n    val dropped = catalog.dropView(ident)\n    if (!dropped && !ifExists) {\n      throw new NoSuchViewException(ident)\n    }\n\n    Nil\n  }\n\n  override def simpleString(maxFields: Int): String = {\n    s\"DropV2View: ${ident}\"\n  }\n}\n","sourceCodeStart":17,"sourceCodeEnd":45,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.2/spark-extensions/src/main/scala/org/apache/spark/sql/execution/datasources/v2/DropV2ViewExec.scala#L17-L45","documentation":"This NoSuchViewException (message 'View not found: <ident>') is thrown by DropV2ViewExec when the view catalog's dropView(ident) returns false and IF EXISTS was not specified. It means the DROP VIEW targeted a view identifier that does not exist in the given V2/ViewCatalog.","triggerScenarios":"Running 'DROP VIEW catalog.db.name' (routed through Iceberg's extended strategy) where no view with that identifier exists in the catalog, and IF EXISTS is absent.","commonSituations":"Typo in the view name or namespace; the view was already dropped; the view exists in a different catalog than the one qualified; case-sensitivity differences between sessions.","solutions":["List existing views (SHOW VIEWS / catalog API) to confirm the exact identifier","Add IF EXISTS: DROP VIEW IF EXISTS catalog.db.name","Check the catalog qualification matches where the view was created","Verify you are connected to the right catalog/environment"],"exampleFix":"// before: fails if view missing\nDROP VIEW iceberg_catalog.db.old_view;\n// after\nDROP VIEW IF EXISTS iceberg_catalog.db.old_view;","handlingStrategy":"try-catch","validationCode":"import org.apache.spark.sql.catalyst.analysis.NoSuchViewException\nval exists = scala.util.Try(spark.sessionState.catalog.tableExists(ident)).getOrElse(false)\nif (!exists && !ifExists) sys.error(s\"View ${ident.quoted} does not exist\")","typeGuard":null,"tryCatchPattern":"try { spark.sql(\"DROP VIEW iceberg_catalog.db.v\") } catch {\n  case e: org.apache.spark.sql.catalyst.analysis.NoSuchViewException =>\n    logWarning(s\"view already gone: ${e.getMessage}\")\n}","preventionTips":["Use DROP VIEW IF EXISTS in scripts that may run repeatedly","Confirm the exact identifier with SHOW VIEWS before dropping","Check the catalog qualification matches where the view was created"],"tags":["spark","iceberg","view","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"}