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

   ### What changes were proposed in this pull request?
   
   This PR replaces the pandas UDF implementations of `np.logaddexp` and 
`np.logaddexp2` in the pandas API on Spark with native Spark SQL expressions. 
The expressions use a numerically stable max-plus-log1p form and explicitly 
handle null, NaN, and infinite inputs.
   
   ### Why are the changes needed?
   
   Using native Spark expressions avoids Python and Arrow execution overhead 
while preserving NumPy-compatible results.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   - Added `test_np_logaddexp`, covering finite values, signed zero, NaN, 
infinities, and extreme finite magnitudes for both ufuncs.
   - `conda run -n spark-dev-313 ruff check 
python/pyspark/pandas/numpy_compat.py 
python/pyspark/pandas/tests/test_numpy_compat.py`
   - `conda run -n spark-dev-313 ruff format --check 
python/pyspark/pandas/numpy_compat.py 
python/pyspark/pandas/tests/test_numpy_compat.py`
   
   The PySpark test could not run locally because the available Java 11 runtime 
cannot load the locally built Java 17 Spark artifacts.
   
   ### 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