ulysses-you commented on code in PR #41088:
URL: https://github.com/apache/spark/pull/41088#discussion_r1281706092


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/DataSourceScanExec.scala:
##########
@@ -383,6 +383,24 @@ trait FileSourceScanLike extends DataSourceScanExec {
     }).flatMap(DataSourceStrategy.translateFilter(_, 
supportNestedPredicatePushdown))
   }
 
+  @transient
+  protected lazy val pushedDownFilters: Seq[Filter] = 
translatePushedDownFilters(dataFilters)
+
+  @transient
+  protected lazy val dynamicallyPushedDownFilters: Seq[Filter] = {
+    if 
(dataFilters.exists(_.exists(_.isInstanceOf[execution.ScalarSubquery]))) {
+      // Replace scalar subquery to literal so that 
`DataSourceStrategy.translateFilter` can
+      // support translate it. The subquery must has been materialized since 
SparkPlan always
+      // execute subquery first.
+      val normalized = dataFilters.map(_.transform {

Review Comment:
   Seems `selectedPartitions` does not accept subquery expression, it filter 
out the dpp filter first.
   
   
https://github.com/apache/spark/blob/e326b9b6565b1e2b697d41714060e2ff9e424514/sql/core/src/main/scala/org/apache/spark/sql/execution/DataSourceScanExec.scala#L252-L257
   
   Then in `dynamicallySelectedPartitions`,  normalized the partition filter.
   
   
https://github.com/apache/spark/blob/e326b9b6565b1e2b697d41714060e2ff9e424514/sql/core/src/main/scala/org/apache/spark/sql/execution/DataSourceScanExec.scala#L268-L281



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