cloud-fan commented on a change in pull request #28805: URL: https://github.com/apache/spark/pull/28805#discussion_r444663074
########## File path: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/PruneFileSourcePartitions.scala ########## @@ -87,8 +88,17 @@ private[sql] object PruneFileSourcePartitions extends Rule[LogicalPlan] { _, _)) if filters.nonEmpty && fsRelation.partitionSchemaOption.isDefined => - val (partitionKeyFilters, _) = getPartitionKeyFiltersAndDataFilters( - fsRelation.sparkSession, logicalRelation, partitionSchema, filters, logicalRelation.output) + val predicates = conjunctiveNormalFormAndGroupExpsByReference(filters.reduceLeft(And)) + val (partitionKeyFilters, _) = if (predicates.nonEmpty) { Review comment: nit: ``` val finalPredicates = if (predicates.nonEmpty) predicates else filters getPartitionKeyFiltersAndDataFilters( fsRelation.sparkSession, logicalRelation, partitionSchema, finalPredicates, logicalRelation.output) ``` ########## File path: sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/PruneHiveTablePartitions.scala ########## @@ -103,7 +103,12 @@ private[sql] class PruneHiveTablePartitions(session: SparkSession) override def apply(plan: LogicalPlan): LogicalPlan = plan resolveOperators { case op @ PhysicalOperation(projections, filters, relation: HiveTableRelation) if filters.nonEmpty && relation.isPartitioned && relation.prunedPartitions.isEmpty => - val partitionKeyFilters = getPartitionKeyFilters(filters, relation) + val predicates = conjunctiveNormalFormAndGroupExpsByReference(filters.reduceLeft(And)) + val partitionKeyFilters = if (predicates.nonEmpty) { Review comment: ditto ---------------------------------------------------------------- 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 --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org