You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "zhengruifeng (via GitHub)" <gi...@apache.org> on 2026/07/31 05:41:49 UTC

[PR] [SPARK-58249][PS][FOLLOWUP] Use native functions for NumPy bitwise shifts [spark]

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

   ### What changes were proposed in this pull request?
   
   Replace the scalar pandas UDF mappings for NumPy left_shift and right_shift on pandas-on-Spark objects with native Spark SQL shiftleft and shiftright functions through call_function. The public PySpark helpers accept only literal shift counts, while NumPy ufunc dispatch can supply column-valued counts.
   
   Native conditional expressions preserve NumPy behavior for negative and out-of-range int64 shift counts. Add pandas-on-Spark parity coverage for signed int64 boundary values and shift counts below, at, and above the bit width.
   
   ### Why are the changes needed?
   
   Spark provides native bit-shift functions, so these mappings no longer need to cross the Python worker boundary.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. NumPy bitwise shifts now execute natively and preserve the Spark integral type of the left operand instead of always returning a long result from the pandas UDF. Their values remain NumPy-compatible, including out-of-range shift counts.
   
   ### How was this patch tested?
   
   - Added pandas-on-Spark parity coverage for NumPy bitwise shifts with int64 boundary values and out-of-range counts.
   - 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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-58464][PS] Use native functions for NumPy bitwise shifts [spark]

Posted by "zhengruifeng (via GitHub)" <gi...@apache.org>.
zhengruifeng closed pull request #57667: [SPARK-58464][PS] Use native functions for NumPy bitwise shifts
URL: https://github.com/apache/spark/pull/57667


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [SPARK-58464][PS] Use native functions for NumPy bitwise shifts [spark]

Posted by "zhengruifeng (via GitHub)" <gi...@apache.org>.
zhengruifeng commented on PR #57667:
URL: https://github.com/apache/spark/pull/57667#issuecomment-5164035936

   **Merge Summary:**
   - merged into master https://github.com/apache/spark/commit/b6c0808a205b98b3f0fd018f923a9804f514804a
   - merged into branch-4.x https://github.com/apache/spark/commit/854f1cdaeaed13e9a8f84030361eb47b3a2b7a99
   
   *Posted by `merge_spark_pr.py`*


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org