From fc84d695651838010811971dea09d1f7c23beb23 Mon Sep 17 00:00:00 2001 From: "Rossi(Ruoxi) Sun" Date: Thu, 21 Dec 2023 01:55:47 -0800 Subject: [PATCH] GH-15192: [C++] Bring back `case_when` tests for union types (#39308) ### Rationale for this change Bring back the problematic test case of random `case_when` on union(bool, string) type. This case used to fail. However #36018 already addressed the issue. More information about how it used to fail, please refer to https://github.com/apache/arrow/issues/15192#issuecomment-1862252174. ### What changes are included in this PR? Bring back the test code. ### Are these changes tested? Yes, the change is the test. ### Are there any user-facing changes? No. * Closes: #15192 Authored-by: zanmato Signed-off-by: Antoine Pitrou --- .../compute/kernels/scalar_if_else_test.cc | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) 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 a11aab81742ed..771261cac9140 100644 --- a/cpp/src/arrow/compute/kernels/scalar_if_else_test.cc +++ b/cpp/src/arrow/compute/kernels/scalar_if_else_test.cc @@ -2485,16 +2485,14 @@ TEST(TestCaseWhen, UnionBoolString) { } } -// FIXME(GH-15192): enabling this test produces test failures - -// TEST(TestCaseWhen, UnionBoolStringRandom) { -// for (const auto& type : std::vector>{ -// sparse_union({field("a", boolean()), field("b", utf8())}, {2, 7}), -// dense_union({field("a", boolean()), field("b", utf8())}, {2, 7})}) { -// ARROW_SCOPED_TRACE(type->ToString()); -// TestCaseWhenRandom(type); -// } -// } +TEST(TestCaseWhen, UnionBoolStringRandom) { + for (const auto& type : std::vector>{ + sparse_union({field("a", boolean()), field("b", utf8())}, {2, 7}), + dense_union({field("a", boolean()), field("b", utf8())}, {2, 7})}) { + ARROW_SCOPED_TRACE(type->ToString()); + TestCaseWhenRandom(type); + } +} TEST(TestCaseWhen, DispatchBest) { CheckDispatchBest("case_when", {struct_({field("", boolean())}), int64(), int32()},