imback82 commented on a change in pull request #27550: [SPARK-30799][SQL]
CatalogAndIdentifier shouldn't return wrong namespace
URL: https://github.com/apache/spark/pull/27550#discussion_r378654745
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/connector/catalog/LookupCatalog.scala
##########
@@ -103,16 +103,7 @@ private[sql] trait LookupCatalog extends Logging {
def unapply(nameParts: Seq[String]): Option[(CatalogPlugin, Identifier)] =
{
assert(nameParts.nonEmpty)
if (nameParts.length == 1) {
- // If the current catalog is session catalog, the current namespace is
not used because
- // the single-part name could be referencing a temp view, which
doesn't belong to any
- // namespaces. An empty namespace will be resolved inside the session
catalog
- // implementation when a relation is looked up.
- val ns = if (CatalogV2Util.isSessionCatalog(currentCatalog)) {
- Array.empty[String]
- } else {
- catalogManager.currentNamespace
- }
- Some((currentCatalog, Identifier.of(ns, nameParts.head)))
+ Some((currentCatalog, Identifier.of(catalogManager.currentNamespace,
nameParts.head)))
Review comment:
> When we call `CatalogAndIdentifier`, the temp view lookup should already
be tried, or the caller side don't want to resolve temp views.
So, `ResolveCatalogs` should be applied after `ResolveTables` and
`ResolveRelations`?
----------------------------------------------------------------
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]