File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
sql/hive/src/main/scala/org/apache/spark/sql/hive Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -173,12 +173,16 @@ private[hive] class HiveMetastoreCatalog(hive: HiveContext) extends Catalog with
173173
174174 def lookupRelation (
175175 tableIdentifier : Seq [String ],
176- alias : Option [String ]): LogicalPlan = synchronized {
176+ alias : Option [String ]): LogicalPlan = {
177177 val tableIdent = processTableIdentifier(tableIdentifier)
178178 val databaseName = tableIdent.lift(tableIdent.size - 2 ).getOrElse(
179179 hive.sessionState.getCurrentDatabase)
180180 val tblName = tableIdent.last
181- val table = try client.getTable(databaseName, tblName) catch {
181+ val table = try {
182+ synchronized {
183+ client.getTable(databaseName, tblName)
184+ }
185+ } catch {
182186 case te : org.apache.hadoop.hive.ql.metadata.InvalidTableException =>
183187 throw new NoSuchTableException
184188 }
@@ -200,7 +204,9 @@ private[hive] class HiveMetastoreCatalog(hive: HiveContext) extends Catalog with
200204 } else {
201205 val partitions : Seq [Partition ] =
202206 if (table.isPartitioned) {
203- HiveShim .getAllPartitionsOf(client, table).toSeq
207+ synchronized {
208+ HiveShim .getAllPartitionsOf(client, table).toSeq
209+ }
204210 } else {
205211 Nil
206212 }
You can’t perform that action at this time.
0 commit comments