viirya commented on a change in pull request #26923: [SPARK-30284][SQL] CREATE 
VIEW should keep the current catalog and namespace
URL: https://github.com/apache/spark/pull/26923#discussion_r362375501
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
 ##########
 @@ -720,6 +721,17 @@ class Analyzer(
     }
   }
 
+  // If we are resolving relations insides views (i.e. 
`AnalysisContext.catalogAndNamespace` is not
+  // empty), we need to expand single-part relation names with the current 
catalog and namespace of
+  // when the view was created.
+  private def expandRelationName(nameParts: Seq[String]): Seq[String] = {
+    if (nameParts.length == 1 && 
AnalysisContext.get.catalogAndNamespace.nonEmpty) {
+      AnalysisContext.get.catalogAndNamespace :+ nameParts.head
+    } else {
+      nameParts
 
 Review comment:
   Yes, I think so. If the first part is not resolved to a catalog, we should 
expand it with current catalog when the view was created.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to