huaxingao commented on a change in pull request #33584:
URL: https://github.com/apache/spark/pull/33584#discussion_r680198489



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/V2ScanRelationPushDown.scala
##########
@@ -57,7 +57,11 @@ object V2ScanRelationPushDown extends Rule[LogicalPlan] with 
PredicateHelper {
       // `postScanFilters` and `pushedFilters` can overlap, e.g. the parquet 
row group filter.
       val (pushedFilters, postScanFiltersWithoutSubquery) = 
PushDownUtils.pushFilters(
         sHolder.builder, normalizedFiltersWithoutSubquery)
-      val postScanFilters = postScanFiltersWithoutSubquery ++ 
normalizedFiltersWithSubquery
+      var postScanFilters = postScanFiltersWithoutSubquery ++ 
normalizedFiltersWithSubquery
+      val partitionFilters = PushDownUtils
+        .pushPartitionFilters(sHolder.builder, sHolder.relation, 
normalizedFiltersWithoutSubquery)
+      postScanFilters =
+        (ExpressionSet(postScanFilters) -- 
partitionFilters.filter(_.references.nonEmpty)).toSeq

Review comment:
       Here we have subtracted the `partitionFilters` from the 
`postScanFilters`. If the file based data source only has partition filters, 
then the `postScanFilters` should be empty here, and we can push down aggregate 
for  file based data source.
   




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to