fuwhu commented on a change in pull request #27232:
[SPARK-30525][SQL]HiveTableScanExec do not need to prune partitions again
URL: https://github.com/apache/spark/pull/27232#discussion_r373508552
##########
File path:
sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/HiveTableScanExec.scala
##########
@@ -162,22 +162,36 @@ case class HiveTableScanExec(
}
}
- // exposed for tests
- @transient lazy val rawPartitions = {
- val prunedPartitions =
- if (sparkSession.sessionState.conf.metastorePartitionPruning &&
- partitionPruningPred.nonEmpty) {
- // Retrieve the original attributes based on expression ID so that
capitalization matches.
- val normalizedFilters = partitionPruningPred.map(_.transform {
- case a: AttributeReference => originalAttributes(a)
- })
- relation.prunedPartitions.getOrElse(
- sparkSession.sessionState.catalog
- .listPartitionsByFilter(relation.tableMeta.identifier,
normalizedFilters))
+ @transient lazy val prunedPartitions: Seq[HivePartition] = {
+ if (relation.prunedPartitions.nonEmpty &&
Review comment:
> else {
> val rawPartitions = prunedPartitionsViaHiveMetaStore()
> prunePartitions(relation.prunedPartitions)
> }
Since prunedPartitionsViaHiveMetaStore will return None if the
HIVE_METASTORE_PARTITION_PRUNING is disabled, so we need to check the result of
prunedPartitionsViaHiveMetaStore here.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]