Skip to content

Commit 4630313

Browse files
rokpitrou
andauthored
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]>
1 parent eb6b637 commit 4630313

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

cpp/src/arrow/compute/kernels/scalar_if_else_test.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3144,6 +3144,14 @@ TEST(TestCoalesce, Boolean) {
31443144
ArrayFromJSON(type, "[true, true, false, true]"));
31453145
CheckScalar("coalesce", {scalar1, values1},
31463146
ArrayFromJSON(type, "[false, false, false, false]"));
3147+
3148+
// Regression test for GH-47234, which was failing due to a MSVC compiler bug
3149+
// (possibly https://developercommunity.visualstudio.com/t/10912292
3150+
// or https://developercommunity.visualstudio.com/t/10945478).
3151+
auto values_with_null = ArrayFromJSON(type, "[true, false, false, false, false, null]");
3152+
auto expected = ArrayFromJSON(type, "[true, false, false, false, false, true]");
3153+
auto scalar2 = ScalarFromJSON(type, "true");
3154+
CheckScalar("coalesce", {values_with_null, scalar2}, expected);
31473155
}
31483156

31493157
TEST(TestCoalesce, DayTimeInterval) {

python/pyarrow/tests/test_compute.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1952,6 +1952,28 @@ def test_fill_null_chunked_array(arrow_type):
19521952
assert result.equals(expected)
19531953

19541954

1955+
def test_fill_null_windows_regression():
1956+
# Regression test for GH-47234, which was failing due to a MSVC compiler bug
1957+
# (possibly https://developercommunity.visualstudio.com/t/10912292
1958+
# or https://developercommunity.visualstudio.com/t/10945478)
1959+
arr = pa.array([True, False, False, False, False, None])
1960+
s = pa.scalar(True, type=pa.bool_())
1961+
1962+
result = pa.compute.call_function("coalesce", [arr, s])
1963+
result.validate(full=True)
1964+
expected = pa.array([True, False, False, False, False, True])
1965+
assert result.equals(expected)
1966+
1967+
for ty in [pa.int8(), pa.int16(), pa.int32(), pa.int64()]:
1968+
arr = pa.array([1, 2, 3, 4, 5, None], type=ty)
1969+
s = pa.scalar(42, type=ty)
1970+
1971+
result = pa.compute.call_function("coalesce", [arr, s])
1972+
result.validate(full=True)
1973+
expected = pa.array([1, 2, 3, 4, 5, 42], type=ty)
1974+
assert result.equals(expected)
1975+
1976+
19551977
def test_logical():
19561978
a = pa.array([True, False, False, None])
19571979
b = pa.array([True, True, False, True])

0 commit comments

Comments
 (0)