rdblue commented on code in PR #9513:
URL: https://github.com/apache/iceberg/pull/9513#discussion_r1468941095


##########
spark/v3.5/spark-extensions/src/main/scala/org/apache/spark/sql/catalyst/analysis/RewriteViewCommands.scala:
##########
@@ -60,17 +65,27 @@ case class RewriteViewCommands(spark: SparkSession) extends 
Rule[LogicalPlan] wi
         properties = properties,
         allowExisting = allowExisting,
         replace = replace)
+
+    case a@AlterViewAs(ResolvedV2View(_, ident, _), _, query) =>
+      val q = CTESubstitution.apply(query)
+      verifyTemporaryObjectsDontExist(ident, q)
+      a.copy(query = q)
+
+    case u@UnresolvedView(IsIcebergView(resolved), _, _, _) =>
+      loadView(resolved.catalog, resolved.identifier)
+        .map(v => ResolvedV2View(resolved.catalog.asViewCatalog, 
resolved.identifier, v))
+        .getOrElse(u)
+
+    case ShowViews(UnresolvedNamespace(ns), pattern, output)
+      if isViewCatalog(spark.sessionState.catalogManager.currentCatalog) =>
+      ShowIcebergViews(UnresolvedNamespace(ns), pattern, output)

Review Comment:
   Shouldn't this resolve the namespace first? This could be called for cases 
like `SHOW VIEWS IN prod.db`, where the `UnresolvedNamespace` has both `prod` 
(a catalog) and `db` (a namespace). This needs to run 
`CatalogAndNamespace.unapply` to get the correct catalog and namespace.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to