Skip to content

Commit

Permalink
[SPARK-18507][SQL] HiveExternalCatalog.listPartitions should only cal…
Browse files Browse the repository at this point in the history
…l getTable once

## What changes were proposed in this pull request?

HiveExternalCatalog.listPartitions should only call `getTable` once, instead of calling it for every partitions.

## How was this patch tested?

N/A

Author: Wenchen Fan <[email protected]>

Closes apache#15978 from cloud-fan/perf.
  • Loading branch information
cloud-fan authored and andrewor14 committed Nov 22, 2016
1 parent 45ea46b commit 702cd40
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -907,8 +907,9 @@ private[spark] class HiveExternalCatalog(conf: SparkConf, hadoopConf: Configurat
db: String,
table: String,
partialSpec: Option[TablePartitionSpec] = None): Seq[CatalogTablePartition] = withClient {
val actualPartColNames = getTable(db, table).partitionColumnNames
client.getPartitions(db, table, partialSpec.map(lowerCasePartitionSpec)).map { part =>
part.copy(spec = restorePartitionSpec(part.spec, getTable(db, table).partitionColumnNames))
part.copy(spec = restorePartitionSpec(part.spec, actualPartColNames))
}
}

Expand Down

0 comments on commit 702cd40

Please sign in to comment.