Github user jiangxb1987 commented on a diff in the pull request:
https://github.com/apache/spark/pull/16168#discussion_r91235206
--- Diff:
sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveSessionCatalog.scala ---
@@ -55,16 +55,19 @@ private[sql] class HiveSessionCatalog(
conf,
hadoopConf) {
- override def lookupRelation(name: TableIdentifier, alias:
Option[String]): LogicalPlan = {
+ override def lookupRelation(
+ name: TableIdentifier,
+ alias: Option[String],
+ databaseHint: Option[String] = None): LogicalPlan = {
val table = formatTableName(name.table)
- val db = formatDatabaseName(name.database.getOrElse(currentDb))
+ val db =
formatDatabaseName(name.database.getOrElse(databaseHint.getOrElse(currentDb)))
if (db == globalTempViewManager.database) {
val relationAlias = alias.getOrElse(table)
globalTempViewManager.get(table).map { viewDef =>
SubqueryAlias(relationAlias, viewDef, Some(name))
}.getOrElse(throw new NoSuchTableException(db, table))
} else if (name.database.isDefined || !tempTables.contains(table)) {
- val database = name.database.map(formatDatabaseName)
+ val database = Some(db).map(formatDatabaseName)
--- End diff --
+1
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]