cloud-fan 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_r362375383
##########
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:
This is a good question! In this case, we should extend the name parts with
the catalog name.
But we should only do it if the first name part doesn't refer to a catalog.
----------------------------------------------------------------
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]