bryanck commented on code in PR #13979:
URL: https://github.com/apache/iceberg/pull/13979#discussion_r2927471164


##########
spark/v4.1/spark-extensions/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveViews.scala:
##########
@@ -102,12 +150,21 @@ case class ResolveViews(spark: SparkSession) extends 
Rule[LogicalPlan] with Look
     }
   }
 
-  private def createViewRelation(nameParts: Seq[String], view: View): 
LogicalPlan = {
+  private def createViewRelation(
+      nameParts: Seq[String],
+      view: View,
+      existingChain: Option[Seq[Seq[String]]] = None): LogicalPlan = {
     val parsed = parseViewText(nameParts.quoted, view.query)
 
     // Apply any necessary rewrites to preserve correct resolution
     val viewCatalogAndNamespace: Seq[String] = view.currentCatalog +: 
view.currentNamespace.toSeq
-    val rewritten = rewriteIdentifiers(parsed, viewCatalogAndNamespace);
+    // Build the view chain: prepend existing chain (from outer views) with 
the current view
+    val currentViewParts = viewCatalogAndNamespace ++ Seq(nameParts.last)

Review Comment:
   Also, if a nested view or table is using a different catalog, perhaps we 
should filter those out or have some solution to handle that case. For example, 
say you have a view `test.bkeller.myview` that selects from a table 
`prod.bkeller.mytable`. The catalog will only get the reference 
`bkeller.myview` so it can't disambiguate if there is also a view 
`prod.bkeller.myview`.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to