Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/17185#discussion_r206381459
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalog.scala
---
@@ -654,16 +654,19 @@ class SessionCatalog(
*
* If the relation is a view, we generate a [[View]] operator from the
view description, and
* wrap the logical plan in a [[SubqueryAlias]] which will track the
name of the view.
+ * [[SubqueryAlias]] will also keep track of the name and
database(optional) of the table/view
*
* @param name The name of the table/view that we look up.
*/
def lookupRelation(name: TableIdentifier): LogicalPlan = {
synchronized {
val db = formatDatabaseName(name.database.getOrElse(currentDb))
val table = formatTableName(name.table)
+ // To keep track of the name and database of the table/view
+ val alias = AliasIdentifier(table, Some(db))
if (db == globalTempViewManager.database) {
globalTempViewManager.get(table).map { viewDef =>
- SubqueryAlias(table, viewDef)
+ SubqueryAlias(alias, viewDef)
--- End diff --
I think we can make `SubqueryAlias` take a `qualifier: Seq[String]` instead
of `alias: String`.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]