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

   ### What changes were proposed in this pull request?
   
   This backports the accepted [SPARK-60486 fix from 
#59732](https://github.com/apache/spark/pull/59732) to branch-4.0. Partition 
predicates that cannot be pushed into the scan are returned for post-scan 
evaluation, while this branch's existing data-filter translation loop is 
preserved. The regression test covers a Python UDF predicate on a partition 
column alone and in AND/OR combinations; the migration guide records the 
behavior change.
   
   ### Why are the changes needed?
   
   `FileScanBuilder` runs before `ExtractPythonUDFs`, so a Python UDF partition 
predicate cannot be pushed into the scan. Previously, the builder excluded it 
from pushdown without returning it as a residual filter, which could omit the 
predicate and return rows that do not satisfy the query. Keeping it as a 
post-scan filter preserves SQL filter semantics.
   
   ### Does this PR introduce any user-facing change?
   
   Yes. Data Source V2 file scans now evaluate deterministic Python UDF 
predicates over partition columns. Previously, such predicates could be dropped 
and return extra rows. The 4.0 migration guide notes that data derived from 
affected query results may need to be recomputed.
   
   ### How was this patch tested?
   
   - Fork CI run 
[40813217879](https://github.com/xgbtxy/spark/actions/runs/40813217879) passed 
Precompile Spark, PySpark SQL, and SQL-other. Both 
`UDFTests.test_file_dsv2_with_udf_filter` and 
`ArrowPythonUDFTests.test_file_dsv2_with_udf_filter` passed with no skips; 
`PruneFileSourcePartitionsSuite` passed 9/9 with no skips.
   - The full workflow is not green. `MLClassLoadingSuite` failed in the fork 
run and also failed on the exact upstream base 
([40804175327](https://github.com/apache/spark/actions/runs/40804175327)). Two 
SparkR `spark.logit` coefficient-tolerance comparisons also failed in the fork 
run; their cause is unverified. These failures are outside the files changed 
here.
   - Black, flake8, and the branch-pinned single-file scalafmt check passed.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: OpenAI Codex (GPT-6)
   


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