Skip to content

Commit

Permalink
apacheGH-15192: [C++] Bring back case_when tests for union types (a…
Browse files Browse the repository at this point in the history
…pache#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 apache#36018 already addressed the issue.

More information about how it used to fail, please refer to apache#15192 (comment).

### 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: apache#15192

Authored-by: zanmato <zanmato1984@gmail.com>
Signed-off-by: Antoine Pitrou <antoine@python.org>
  • Loading branch information
zanmato1984 authored Dec 21, 2023
1 parent 5df541d commit 2308cdf
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions cpp/src/arrow/compute/kernels/scalar_if_else_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::shared_ptr<DataType>>{
// 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<std::shared_ptr<DataType>>{
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()},
Expand Down

0 comments on commit 2308cdf

Please sign in to comment.