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

   ### What changes were proposed in this pull request?
   
   This PR replaces the pandas UDF implementations of `np.fmax` and `np.fmin` 
in pandas API on Spark with native Spark expressions.
   
   `fmax` explicitly selects the non-NaN operand before using `greatest`. 
`fmin` uses `least`, whose NaN ordering matches NumPy `fmin`. Both results are 
cast to `double`, matching the existing pandas UDF return type.
   
   ### Why are the changes needed?
   
   Using native Spark expressions avoids pandas UDF and Arrow overhead while 
preserving NumPy NaN-handling semantics.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   Added `NumPyCompatTests.test_np_fmax_fmin`, covering integral inputs, NaNs, 
infinities, and signed zero.
   
   - `ruff check python/pyspark/pandas/numpy_compat.py 
python/pyspark/pandas/tests/test_numpy_compat.py`
   - `ruff format --check python/pyspark/pandas/numpy_compat.py 
python/pyspark/pandas/tests/test_numpy_compat.py`
   - `python -m unittest 
pyspark.pandas.tests.test_numpy_compat.NumPyCompatTests.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