cloud-fan commented on a change in pull request #26741: [SPARK-30104][SQL] Fix
catalog resolution for 'global_temp'
URL: https://github.com/apache/spark/pull/26741#discussion_r356193530
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/connector/catalog/LookupCatalog.scala
##########
@@ -88,19 +88,50 @@ private[sql] trait LookupCatalog extends Logging {
}
/**
- * Extract catalog and namespace from a multi-part identifier with the
current catalog if needed.
+ * Extract catalog and namespace from a multi-part name with the current
catalog if needed.
* Catalog name takes precedence over namespaces.
*/
object CatalogAndNamespace {
- def unapply(parts: Seq[String]): Some[(CatalogPlugin,
Option[Seq[String]])] = parts match {
- case Seq(catalogName, tail @ _*) =>
+ def unapply(nameParts: Seq[String]): Some[(CatalogPlugin, Seq[String])] = {
+ assert(nameParts.nonEmpty)
+ try {
+ Some((catalogManager.catalog(nameParts.head), nameParts.tail))
+ } catch {
+ case _: CatalogNotFoundException =>
+ Some((currentCatalog, nameParts))
+ }
+ }
+ }
+
+ /**
+ * Extract catalog and identifier from a multi-part name with the current
catalog if needed.
+ * Identifier takes precedence over catalog name.
Review comment:
This is not accurate. catalog name still takes precedence, we just have a
special case for single-part name.
----------------------------------------------------------------
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]