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
173
173
174
174
def lookupRelation (
175
175
tableIdentifier : Seq [String ],
176
- alias : Option [String ]): LogicalPlan = synchronized {
176
+ alias : Option [String ]): LogicalPlan = {
177
177
val tableIdent = processTableIdentifier(tableIdentifier)
178
178
val databaseName = tableIdent.lift(tableIdent.size - 2 ).getOrElse(
179
179
hive.sessionState.getCurrentDatabase)
180
180
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 {
182
186
case te : org.apache.hadoop.hive.ql.metadata.InvalidTableException =>
183
187
throw new NoSuchTableException
184
188
}
@@ -200,7 +204,9 @@ private[hive] class HiveMetastoreCatalog(hive: HiveContext) extends Catalog with
200
204
} else {
201
205
val partitions : Seq [Partition ] =
202
206
if (table.isPartitioned) {
203
- HiveShim .getAllPartitionsOf(client, table).toSeq
207
+ synchronized {
208
+ HiveShim .getAllPartitionsOf(client, table).toSeq
209
+ }
204
210
} else {
205
211
Nil
206
212
}
You can’t perform that action at this time.
0 commit comments