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

   ### What changes were proposed in this pull request?
   
   Replace the pandas UDF mapping for NumPy trunc on pandas-on-Spark objects 
with native Spark expressions. The implementation uses the remainder of the 
absolute double value and reapplies the sign, preserving nulls, NaN, 
infinities, and signed zero. Add coverage for these values and fractional 
positive and negative inputs.
   
   ### Why are the changes needed?
   
   Spark does not provide a numeric trunc function, but the operation can be 
evaluated with native expressions without crossing the Python worker boundary.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   - Added parity coverage in `NumPyCompatTests.test_np_math_functions`.
   - Manually verified the native expression for signed zero, fractional 
values, infinities, NaN, and large doubles.
   - Passed Ruff format and lint checks for the changed Python files.
   - Focused PySpark tests were not run locally.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Codex (GPT-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