ulysses-you commented on code in PR #41088:
URL: https://github.com/apache/spark/pull/41088#discussion_r1189452525
##########
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:
I think we are not able to update it. metadata would be used by explain
which is invoked before executing and we get the pushed filter with scalar
subqueris at runtime.
--
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]