imback82 commented on a change in pull request #27532: [SPARK-30782][SQL]
Column resolution doesn't respect current catalog/namespace for v2 tables.
URL: https://github.com/apache/spark/pull/27532#discussion_r380008030
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
##########
@@ -932,8 +934,17 @@ class Analyzer(
case v1Table: V1Table =>
v1SessionCatalog.getRelation(v1Table.v1Table)
case table =>
+ // Note that SessionCatalogAndIdentifier doesn't update the
namespace if the resolved
+ // identifier has a single-part name because it could reference
a temp view which does
+ // not belong to any namespaces. For v1 tables, namespace is
resolved in
+ // `SessionCatalog.getRelation`.
+ val ns = if (ident.namespace.isEmpty) {
+ catalogManager.currentNamespace
Review comment:
This is still problematic even after #27550 because we allow
`spark_catalog.t`. It will be resolved to an identifier with an empty namespace
in `CatalogAndIdentifier` whereas `v1SessionCatalog` always uses current
database if the given namespace (database) is empty. Should I just go ahead and
disallow `spark_catalog.t`? What do you think? We briefly discussed this issue
here: https://github.com/apache/spark/pull/27550#discussion_r379245778
----------------------------------------------------------------
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]