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_r373928619
########## 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) { Review comment: sure, added. ---------------------------------------------------------------- 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