Skip to content

Commit

Permalink
[SQL] Use HiveContext's sessionState in HiveMetastoreCatalog.hiveDefa…
Browse files Browse the repository at this point in the history
…ultTableFilePath

`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.

(cherry picked from commit 548c9c2)
Signed-off-by: Michael Armbrust <michael@databricks.com>
  • Loading branch information
yhuai authored and marmbrus committed Feb 4, 2015
1 parent 513bb2c commit cb4c3e5
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit cb4c3e5

Please sign in to comment.