viirya commented on code in PR #41088:
URL: https://github.com/apache/spark/pull/41088#discussion_r1189388803
##########
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 {
+ case scalarSubquery: execution.ScalarSubquery =>
scalarSubquery.toLiteral
+ })
+ translatePushedDownFilters(normalized)
+ } else {
+ pushedDownFilters
+ }
+ }
+
override lazy val metadata: Map[String, String] = {
Review Comment:
This `metadata` also contains `pushedDownFilters`, do we need to update it?
Or, are we able to update it?
--
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]