[SPARK-2485][SQL] Lock usage of hive client.
Author: Michael Armbrust <michael@databricks.com> Closes #1412 from marmbrus/lockHiveClient and squashes the following commits: 4bc9d5a [Michael Armbrust] protected[hive] 22e9177 [Michael Armbrust] Add comments. 7aa8554 [Michael Armbrust] Don't lock on hive's object. a6edc5f [Michael Armbrust] Lock usage of hive client.
This commit is contained in:
parent
c6d75745de
commit
c7c7ac8339
|
@ -43,14 +43,15 @@ import scala.collection.JavaConversions._
|
|||
private[hive] class HiveMetastoreCatalog(hive: HiveContext) extends Catalog with Logging {
|
||||
import HiveMetastoreTypes._
|
||||
|
||||
val client = Hive.get(hive.hiveconf)
|
||||
/** Connection to hive metastore. Usages should lock on `this`. */
|
||||
protected[hive] val client = Hive.get(hive.hiveconf)
|
||||
|
||||
val caseSensitive: Boolean = false
|
||||
|
||||
def lookupRelation(
|
||||
db: Option[String],
|
||||
tableName: String,
|
||||
alias: Option[String]): LogicalPlan = {
|
||||
alias: Option[String]): LogicalPlan = synchronized {
|
||||
val (dbName, tblName) = processDatabaseAndTableName(db, tableName)
|
||||
val databaseName = dbName.getOrElse(hive.sessionState.getCurrentDatabase)
|
||||
val table = client.getTable(databaseName, tblName)
|
||||
|
|
Loading…
Reference in a new issue