LuciferYang commented on code in PR #60387:
URL: https://github.com/apache/spark/pull/60387#discussion_r4573100728


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/InjectRuntimeFilter.scala:
##########
@@ -244,6 +245,18 @@ object InjectRuntimeFilter extends Rule[LogicalPlan] with 
PredicateHelper with J
           targetKey,
           currentPlan,
           useMaterializedThreshold = false))
+      // A DSv2 scan can take a filter in fully and leave no `Filter` for it, 
as a built-in file
+      // scan does with its partition filters. With no selective `Filter` 
above the scan, its
+      // pushed filters count as such a `Filter` would, but only for a scan 
whose pushed operations
+      // all work on each row by itself, since the bloom filter's subquery 
reads it again. A pushed
+      // limit, for example, lets the source pick other rows on a second read.
+      case scan: DataSourceV2ScanRelation if scan.onlyRowWisePushdowns &&
+          scan.pushedFilters.forall(isSimpleExpression) &&
+          scan.pushedFilters.exists(isLikelySelective) =>
+        Some(FilterCreationSide(

Review Comment:
   Done in 20f53216f26. A side found through pushed filters now also has to fit 
the creation-side threshold, so a scan that reports no size, or one over it, 
returns `None` and the join above can take its other side, as on master. The 
SPARK-61173 test has that shape: a large DSv2 scan with a pushed filter joined 
to `bf2 WHERE b2 = 23`, where `f.part` gets its bloom filter from `bf2`. I 
shared only the size check. Pushed filters are simple and deterministic, so 
they cannot fail the Python UDF and determinism checks. `canEvaluateAgain` can 
still reject such a side for a key whose DPP filter is dropped, for example 
with a pushed `RLIKE`, which then stops the search as a `Filter` above the scan 
does on master.



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