aboutsummaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorYin Huai <yhuai@databricks.com>2015-02-04 15:22:40 -0800
committerMichael Armbrust <michael@databricks.com>2015-02-04 15:22:40 -0800
commit548c9c2b2a1612f5e4342de322b72b9e78140618 (patch)
tree29b68bc930f2e7d31f57ae37d4c28875fb056e8a /sql
parent0d81645f776aeca6a48322da392d4fac18431556 (diff)
downloadspark-548c9c2b2a1612f5e4342de322b72b9e78140618.tar.gz
spark-548c9c2b2a1612f5e4342de322b72b9e78140618.tar.bz2
spark-548c9c2b2a1612f5e4342de322b72b9e78140618.zip
[SQL] Use HiveContext's sessionState in HiveMetastoreCatalog.hiveDefaultTableFilePath
`client.getDatabaseCurrent` uses SessionState's local variable which can be an issue. Author: Yin Huai <yhuai@databricks.com> Closes #4355 from yhuai/defaultTablePath and squashes the following commits: 84a29e5 [Yin Huai] Use HiveContext's sessionState instead of using SessionState's thread local variable.
Diffstat (limited to 'sql')
-rw-r--r--sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala b/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala
index bcb4726e90..243310686d 100644
--- a/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala
+++ b/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala
@@ -140,7 +140,8 @@ private[hive] class HiveMetastoreCatalog(hive: HiveContext) extends Catalog with
}
def hiveDefaultTableFilePath(tableName: String): String = {
- hiveWarehouse.getTablePath(client.getDatabaseCurrent, tableName).toString
+ val currentDatabase = client.getDatabase(hive.sessionState.getCurrentDatabase())
+ hiveWarehouse.getTablePath(currentDatabase, tableName).toString
}
def tableExists(tableIdentifier: Seq[String]): Boolean = {