Skip to content

Commit cb4c3e5

Browse files
yhuaimarmbrus
authored andcommitted
[SQL] Use HiveContext's sessionState in HiveMetastoreCatalog.hiveDefaultTableFilePath
`client.getDatabaseCurrent` uses SessionState's local variable which can be an issue. Author: Yin Huai <[email protected]> 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 <[email protected]>
1 parent 513bb2c commit cb4c3e5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveMetastoreCatalog.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ private[hive] class HiveMetastoreCatalog(hive: HiveContext) extends Catalog with
140140
}
141141

142142
def hiveDefaultTableFilePath(tableName: String): String = {
143-
hiveWarehouse.getTablePath(client.getDatabaseCurrent, tableName).toString
143+
val currentDatabase = client.getDatabase(hive.sessionState.getCurrentDatabase())
144+
hiveWarehouse.getTablePath(currentDatabase, tableName).toString
144145
}
145146

146147
def tableExists(tableIdentifier: Seq[String]): Boolean = {

0 commit comments

Comments
 (0)