Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1232,13 +1232,14 @@ private[spark] class HiveExternalCatalog(conf: SparkConf, hadoopConf: Configurat
db: String,
table: String,
partialSpec: Option[TablePartitionSpec] = None): Seq[CatalogTablePartition] = withClient {
val partColNameMap = buildLowerCasePartColNameMap(getTable(db, table))
val catalogTable = getTable(db, table)
val partColNameMap = buildLowerCasePartColNameMap(catalogTable)
val metaStoreSpec = partialSpec.map(toMetaStorePartitionSpec)
val res = client.getPartitions(db, table, metaStoreSpec)
.map { part => part.copy(spec = restorePartitionSpec(part.spec, partColNameMap))
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you are here, could you move } up:

.map { part => part.copy(spec = restorePartitionSpec(part.spec, partColNameMap)) }


metaStoreSpec match {
val parts = metaStoreSpec match {
// This might be a bug of Hive: When the partition value inside the partial partition spec
// contains dot, and we ask Hive to list partitions w.r.t. the partial partition spec, Hive
// treats dot as matching any single character and may return more partitions than we
Expand All @@ -1247,6 +1248,7 @@ private[spark] class HiveExternalCatalog(conf: SparkConf, hadoopConf: Configurat
res.filter(p => isPartialPartitionSpec(spec, p.spec))
case _ => res
}
parts.map { part => restorePartitionMetadata(part, catalogTable) }
}

override def listPartitionsByFilter(
Expand All @@ -1266,6 +1268,7 @@ private[spark] class HiveExternalCatalog(conf: SparkConf, hadoopConf: Configurat
part.copy(spec = restorePartitionSpec(part.spec, partColNameMap))
}
prunePartitionsByFilter(catalogTable, clientPrunedPartitions, predicates, defaultTimeZoneId)
.map { part => restorePartitionMetadata(part, catalogTable) }
}

// --------------------------------------------------------------------------
Expand Down