singhpk234 commented on code in PR #13979:
URL: https://github.com/apache/iceberg/pull/13979#discussion_r3846257548
##########
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:
Good catch! You're right `viewCatalogAndNamespace` (the spec's
default-catalog/default-namespace for view) represents the session context at
view creation time, meant only for resolving unqualified references inside the
view's SQL body. It shouldn't be used to identify the view itself in the
referenced-by chain.
Fixed by using the session-resolved identity from CatalogAndIdentifier for
the outermost view's chain entry. viewCatalogAndNamespace is still used only
for rewriteIdentifiers (its correct purpose per spec).
--
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]