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

   ### What changes were proposed in this pull request?
   
   This follow-up fixes the native `np.fmax` and `np.fmin` mappings to preserve 
the first operand when the operands compare equal. This preserves NumPy 
signed-zero behavior while retaining the existing NaN handling and native Spark 
expressions.
   
   ### Why are the changes needed?
   
   Spark `greatest` and `least` order `-0.0` and `+0.0`, whereas NumPy retains 
the first operand for an equal-value tie. Consequently, the prior mapping 
returned the wrong signed zero for `fmax(-0.0, 0.0)` and `fmin(0.0, -0.0)`.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. It corrects the sign of zero for the affected `np.fmax` and `np.fmin` 
inputs.
   
   ### How was this patch tested?
   
   Added signbit-based regression coverage for both signed-zero operand orders.
   
   - `python/run-tests --testnames 
pyspark.pandas.tests.test_numpy_compat.NumPyCompatTests.test_np_fmax_fmin`
   - `python/run-tests --testnames 
pyspark.pandas.tests.connect.test_parity_numpy_compat.NumPyCompatParityTests.test_np_fmax_fmin`
   
   ### 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