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

apitrou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new 4630313644 GH-47234: [C++][Python] Add test for fill_null regression 
on Windows (#47249)
4630313644 is described below

commit 4630313644e7b3f74fcd5fd0398e0d945fac89e7
Author: Rok Mihevc <[email protected]>
AuthorDate: Mon Sep 15 18:49:19 2025 +0200

    GH-47234: [C++][Python] Add test for fill_null regression on Windows 
(#47249)
    
    ### Rationale for this change
    
    Add regression test for an issue that surfaced on specific MSVC versions, 
presumably due to a compiler bug.
    
    Possible upstream tickets are 
https://developercommunity.visualstudio.com/t/Code-optimization-bug-SIMD-std::transf/10912292
 and 
https://developercommunity.visualstudio.com/t/SIMD-Code-optimization-bug/10945478.
    
    ### What changes are included in this PR?
    
    Additional tests to catch any further occurrence of this specific problem.
    
    ### Are these changes tested?
    
    Obviously yes.
    
    ### Are there any user-facing changes?
    
    No.
    
    * GitHub Issue: #47234
    
    Lead-authored-by: Antoine Pitrou <[email protected]>
    Co-authored-by: Rok Mihevc <[email protected]>
    Co-authored-by: Antoine Pitrou <[email protected]>
    Signed-off-by: Antoine Pitrou <[email protected]>
---
 .../arrow/compute/kernels/scalar_if_else_test.cc   |  8 ++++++++
 python/pyarrow/tests/test_compute.py               | 22 ++++++++++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/cpp/src/arrow/compute/kernels/scalar_if_else_test.cc 
b/cpp/src/arrow/compute/kernels/scalar_if_else_test.cc
index e007a16d13..196912679b 100644
--- a/cpp/src/arrow/compute/kernels/scalar_if_else_test.cc
+++ b/cpp/src/arrow/compute/kernels/scalar_if_else_test.cc
@@ -3144,6 +3144,14 @@ TEST(TestCoalesce, Boolean) {
               ArrayFromJSON(type, "[true, true, false, true]"));
   CheckScalar("coalesce", {scalar1, values1},
               ArrayFromJSON(type, "[false, false, false, false]"));
+
+  // Regression test for GH-47234, which was failing due to a MSVC compiler bug
+  // (possibly https://developercommunity.visualstudio.com/t/10912292
+  // or https://developercommunity.visualstudio.com/t/10945478).
+  auto values_with_null = ArrayFromJSON(type, "[true, false, false, false, 
false, null]");
+  auto expected = ArrayFromJSON(type, "[true, false, false, false, false, 
true]");
+  auto scalar2 = ScalarFromJSON(type, "true");
+  CheckScalar("coalesce", {values_with_null, scalar2}, expected);
 }
 
 TEST(TestCoalesce, DayTimeInterval) {
diff --git a/python/pyarrow/tests/test_compute.py 
b/python/pyarrow/tests/test_compute.py
index ad61dbc48a..5441dd493d 100644
--- a/python/pyarrow/tests/test_compute.py
+++ b/python/pyarrow/tests/test_compute.py
@@ -1952,6 +1952,28 @@ def test_fill_null_chunked_array(arrow_type):
     assert result.equals(expected)
 
 
+def test_fill_null_windows_regression():
+    # Regression test for GH-47234, which was failing due to a MSVC compiler 
bug
+    # (possibly https://developercommunity.visualstudio.com/t/10912292
+    # or https://developercommunity.visualstudio.com/t/10945478)
+    arr = pa.array([True, False, False, False, False, None])
+    s = pa.scalar(True, type=pa.bool_())
+
+    result = pa.compute.call_function("coalesce", [arr, s])
+    result.validate(full=True)
+    expected = pa.array([True, False, False, False, False, True])
+    assert result.equals(expected)
+
+    for ty in [pa.int8(), pa.int16(), pa.int32(), pa.int64()]:
+        arr = pa.array([1, 2, 3, 4, 5, None], type=ty)
+        s = pa.scalar(42, type=ty)
+
+        result = pa.compute.call_function("coalesce", [arr, s])
+        result.validate(full=True)
+        expected = pa.array([1, 2, 3, 4, 5, 42], type=ty)
+        assert result.equals(expected)
+
+
 def test_logical():
     a = pa.array([True, False, False, None])
     b = pa.array([True, True, False, True])

Reply via email to