LuciferYang opened a new pull request, #60387:
URL: https://github.com/apache/spark/pull/60387

   ### What changes were proposed in this pull request?
   
   `InjectRuntimeFilter` looks for a selective predicate over a scan only in a 
`Filter` above it. A DSv2 scan that takes a filter in fully leaves no `Filter` 
for it, as a built-in V2 file scan does with its partition filters, so such a 
dimension could not build a bloom filter, while the same dimension read through 
V1 can.
   
   This PR lets a `DataSourceV2ScanRelation` with no selective `Filter` above 
it count its `pushedFilters` instead:
   
   - They must be simple (`isSimpleExpression`), and one of them likely 
selective, as a `Filter`'s condition must.
   - The scan must have only row-wise pushdowns (`onlyRowWisePushdowns`), since 
the bloom filter's subquery reads it again. A pushed limit, top-N or sample 
could give other rows.
   
   For a key whose DPP filter physical planning drops (SPARK-60702), 
`canEvaluateAgain` also requires the pushed filters a DSv2 scan records to pass 
`cannotFail`, as it does for a `Filter`.
   
   ### Why are the changes needed?
   
   With SPARK-30628, a V2 file fact gets a DPP filter, which a shuffle join 
with no broadcast to reuse turns into `true`. V1 can then add a bloom filter 
from a dimension filtered only on its partition columns, for example by an 
equality, while V2 got no runtime filter at all.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. A shuffle join whose dimension is a DSv2 scan with a fully pushed 
selective filter can get a runtime bloom filter, for example a V2 file 
dimension filtered only on partition columns. For a key whose DPP filter is 
dropped, a DSv2 scan with a pushed filter that fails `cannotFail`, such as 
`RLIKE`, now builds none under a selective `Filter`, as in V1, where it built 
one before. Results are the same.
   
   ### How was this patch tested?
   
   A new test in `InjectRuntimeFilterSuite`, with AQE on and off and against 
V1: a partition equality gets a bloom filter with and without DPP, a partition 
`RLIKE` only without DPP, also under a selective data filter, since 
`cannotFail` does not take it, and a `LIKE` alone never, since it is not 
simple. A dimension scan marked as not row-wise gets none.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Opus 5.5)
   


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