Skip to content
Snippets Groups Projects
Commit c7c7ac83 authored by Michael Armbrust's avatar Michael Armbrust Committed by Aaron Davidson
Browse files

[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.
parent c6d75745
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment