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


##########
spark/v4.1/spark-extensions/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveViews.scala:
##########
@@ -102,12 +131,19 @@ 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: Seq[Seq[String]] = Seq.empty): 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);
+
+    val viewChain =
+      ViewUtil.buildViewChain(nameParts, viewCatalogAndNamespace, 
existingChain, isCatalog)

Review Comment:
   If existingChain is empty, should the viewChain be built initially with the 
current session's catalog and namespace instead of `viewCatalogAndNamespace` at 
time of creation? For example, the view was created in a session where default 
namespace is `default` but qualified as `create view analytics.view ...`. Then, 
the user in a new session does this sql query 
   ```sql
   USE analytics;
   select * from view
   ```
   the referenced-by would contain [default.view] instead of [analytics.view]. 
This seems to mirror the load functionality, using current session catalog at 
query time before using the view catalog and namespace for the body.



-- 
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