This is an automated email from the ASF dual-hosted git repository.

ruifengz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new 1b1904ec9f79 [SPARK-55405][PYTHON][TESTS][FOLLOW-UP] Add macOS ARM 
overrides for float-to-int unsafe cast golden file mismatches
1b1904ec9f79 is described below

commit 1b1904ec9f790398e53d95fe6d0e3f3bec18d5a3
Author: Yicong-Huang <[email protected]>
AuthorDate: Fri Feb 27 13:16:17 2026 +0800

    [SPARK-55405][PYTHON][TESTS][FOLLOW-UP] Add macOS ARM overrides for 
float-to-int unsafe cast golden file mismatches
    
    ### What changes were proposed in this pull request?
    
    Add macOS ARM-specific overrides in `_overrides_unsafe()` for 7 
float-to-int unsafe cast cases that differ between Linux ARM and macOS ARM due 
to LLVM code generation differences. This fixes the `build_python_3.12_macos26` 
CI workflow which has been failing on every run.
    
    ### Why are the changes needed?
    
    Fix macOS 26 CI failures.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    Tested on macOS 26 (Darwin 25.2.0, arm64) with PyArrow 22.0.0. Also tested 
in CI: https://github.com/Yicong-Huang/spark/actions/runs/22465733224
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    No.
    
    Closes #54525 from 
Yicong-Huang/SPARK-55405/fix/macos26-arm-float-int-cast-overrides.
    
    Authored-by: Yicong-Huang <[email protected]>
    Signed-off-by: Ruifeng Zheng <[email protected]>
---
 .../upstream/pyarrow/test_pyarrow_array_cast.py     | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/python/pyspark/tests/upstream/pyarrow/test_pyarrow_array_cast.py 
b/python/pyspark/tests/upstream/pyarrow/test_pyarrow_array_cast.py
index b182e254b90f..6242a6d784da 100644
--- a/python/pyspark/tests/upstream/pyarrow/test_pyarrow_array_cast.py
+++ b/python/pyspark/tests/upstream/pyarrow/test_pyarrow_array_cast.py
@@ -587,6 +587,27 @@ class PyArrowScalarTypeCastTests(_PyArrowCastTestBase):
                 }
             )
 
+            if platform.system() == "Darwin":
+                # macOS ARM differs from Linux ARM for some unsafe casts due to
+                # differences in LLVM code generation between the two 
platforms.
+                overrides.update(
+                    {
+                        # negative float → uint8/uint16: macOS ARM wraps 
(255/65535),
+                        # Linux ARM saturates to 0
+                        ("float16:standard", "uint8"): "[0, 1, 255, 
None]@uint8",
+                        ("float16:standard", "uint16"): "[0, 1, 65535, 
None]@uint16",
+                        ("float32:standard", "uint8"): "[0, 1, 255, 
None]@uint8",
+                        ("float64:standard", "uint8"): "[0, 1, 255, 
None]@uint8",
+                        ("float64:standard", "uint16"): "[0, 1, 65535, 
None]@uint16",
+                        # negative float → uint32: macOS ARM saturates to 0,
+                        # Linux ARM wraps to 4294967295 (matching x86 golden)
+                        ("float64:standard", "uint32"): "[0, 1, 0, 
None]@uint32",
+                        # special float → int32: macOS ARM saturates 
(INT32_MAX/MIN),
+                        # Linux ARM gives -1/0
+                        ("float64:special", "int32"): "[2147483647, 
-2147483648, 0, None]@int32",
+                    }
+                )
+
         return overrides
 
     # ----- test methods -----


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to