fuwhu commented on a change in pull request #27232: [SPARK-30525][SQL]HiveTableScanExec do not need to prune partitions again after pushing down to SessionCatalog for partition pruning URL: https://github.com/apache/spark/pull/27232#discussion_r373928650
########## File path: sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/HiveTableScanExec.scala ########## @@ -162,11 +162,29 @@ case class HiveTableScanExec( } } + @transient lazy val prunedPartitions: Seq[HivePartition] = { + if (relation.prunedPartitions.nonEmpty) { + val hivePartitions = + relation.prunedPartitions.get.map(HiveClientImpl.toHivePartition(_, hiveQlTable)) + if (partitionPruningPred.forall(!ExecSubqueryExpression.hasSubquery(_))) { + hivePartitions + } else { + prunePartitions(hivePartitions) + } + } else { + if (sparkSession.sessionState.conf.metastorePartitionPruning) { + rawPartitions + } else { + prunePartitions(rawPartitions) + } + } + } + // exposed for tests - @transient lazy val rawPartitions = { + @transient lazy val rawPartitions: Seq[HivePartition] = { Review comment: sure, removed. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org