zhengruifeng opened a new pull request, #57668: URL: https://github.com/apache/spark/pull/57668
### What changes were proposed in this pull request? Replace the scalar pandas UDF mapping for NumPy reciprocal on pandas-on-Spark objects with native Spark SQL expressions. The expression uses typeof to distinguish Boolean, integral, and floating-point inputs. It preserves NumPy integer reciprocal behavior, including integer-zero overflow, as well as floating-point NaN, infinity, and signed-zero behavior. Add parity coverage for all of these cases. ### Why are the changes needed? The mapping can be evaluated with native Spark SQL expressions, avoiding the Python worker boundary while retaining NumPy-compatible results. ### Does this PR introduce _any_ user-facing change? No. It preserves the existing NumPy-compatible result values and double output type. ### How was this patch tested? - Added pandas-on-Spark parity coverage for NumPy reciprocal on Boolean, int64, and float64 inputs, including zero, signed zero, NaN, and infinity. - Ran JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 SPARK_TESTING=1 SPARK_PREPEND_CLASSES=1 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]
