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

   ### What changes were proposed in this pull request?
   
   Correct the pandas-on-Spark mappings for NumPy `isfinite` and `isinf`. Both 
predicates now check positive and negative infinity, and `isfinite` also 
excludes `NaN`. Add pandas-on-Spark parity coverage for finite values, both 
infinities, signed zero, and `NaN`.
   
   ### Why are the changes needed?
   
   The existing mappings recognize only positive infinity. As a result, 
`np.isfinite` incorrectly returned true for negative infinity and `NaN`, while 
`np.isinf` incorrectly returned false for negative infinity.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. `np.isfinite` and `np.isinf` on pandas-on-Spark objects now return 
NumPy-compatible results for negative infinity and `NaN`.
   
   ### How was this patch tested?
   
   - Added pandas-on-Spark parity coverage for finite values, infinities, 
signed zero, and `NaN`.
   - Ran `build/sbt -java-home /usr/lib/jvm/java-17-openjdk-amd64 -Phive 
package`.
   - Ran `JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 SPARK_TESTING=1 
SPARK_PREPEND_CLASSES=1 PYSPARK_PYTHON=.venv/bin/python 
PYSPARK_DRIVER_PYTHON=.venv/bin/python python/run-tests --testnames 
pyspark.pandas.tests.test_numpy_compat`.
   - Ran `git diff --check`.
   
   ### 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