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



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/PushDownUtils.scala
##########
@@ -117,7 +145,11 @@ object PushDownUtils extends PredicateHelper {
       relation: DataSourceV2Relation,
       projects: Seq[NamedExpression],
       filters: Seq[Expression]): (Scan, Seq[AttributeReference]) = {
-    val exprs = projects ++ filters
+    val filePartitionFilter = scanBuilder match {
+      case fileScanBuilder: FileScanBuilder => 
fileScanBuilder.getPartitionFilters

Review comment:
       ```
   If we don't want to touch PruneFileSourcePartitions, I guess instead of 
checking if the postScanFilter is empty using if filters.isEmpty, we do 
something like this:
   
   if (JDBC)
     if filters.isEmpty
        push down aggregate
   else // file based
     if filters are only partition filters
       push down aggregate
   This looks hacky though. Please let me know if anybody has a better idea.
   ```
   @huaxingao I don't have a better idea either. 
   But you have to match special case `FileScanBuilder` here anyway. I would 
prefer resolving the partition filters in `pushAggregates`, which is more 
straightforward. 




-- 
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: reviews-unsubscr...@spark.apache.org

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

Reply via email to