diff --git a/cpp/src/arrow/compute/kernels/scalar_string_test.cc b/cpp/src/arrow/compute/kernels/scalar_string_test.cc index 785c82ca044..16ab551283c 100644 --- a/cpp/src/arrow/compute/kernels/scalar_string_test.cc +++ b/cpp/src/arrow/compute/kernels/scalar_string_test.cc @@ -1186,9 +1186,9 @@ TYPED_TEST(TestStringKernels, BinaryJoin) { auto expected = ArrayFromJSON(this->type(), R"(["a--bb--ccc", "", null, "dd", null, "ff--"])"); CheckScalarBinary("binary_join", ArrayFromJSON(list(this->type()), list_json), - separator, expected); + Datum(separator), expected); CheckScalarBinary("binary_join", ArrayFromJSON(large_list(this->type()), list_json), - separator, expected); + Datum(separator), expected); auto separator_null = MakeNullScalar(this->type()); expected = ArrayFromJSON(this->type(), R"([null, null, null, null, null, null])"); diff --git a/cpp/src/arrow/compute/kernels/test_util.cc b/cpp/src/arrow/compute/kernels/test_util.cc index ce8d42e34c2..ceea9cbc15c 100644 --- a/cpp/src/arrow/compute/kernels/test_util.cc +++ b/cpp/src/arrow/compute/kernels/test_util.cc @@ -174,10 +174,10 @@ void CheckScalar(std::string func_name, const DatumVector& inputs, Datum expecte } } -void CheckScalarUnary(std::string func_name, std::shared_ptr input, - std::shared_ptr expected, const FunctionOptions* options) { - ArrayVector input_vector = {input}; - CheckScalar(std::move(func_name), GetDatums(input_vector), expected, options); +void CheckScalarUnary(std::string func_name, Datum input, Datum expected, + const FunctionOptions* options) { + std::vector input_vector = {std::move(input)}; + CheckScalar(std::move(func_name), input_vector, expected, options); } void CheckScalarUnary(std::string func_name, std::shared_ptr in_ty, @@ -187,11 +187,6 @@ void CheckScalarUnary(std::string func_name, std::shared_ptr in_ty, ArrayFromJSON(out_ty, json_expected), options); } -void CheckScalarUnary(std::string func_name, std::shared_ptr input, - std::shared_ptr expected, const FunctionOptions* options) { - CheckScalar(std::move(func_name), {input}, expected, options); -} - void CheckVectorUnary(std::string func_name, Datum input, std::shared_ptr expected, const FunctionOptions* options) { ASSERT_OK_AND_ASSIGN(Datum out, CallFunction(func_name, {input}, options)); @@ -200,27 +195,8 @@ void CheckVectorUnary(std::string func_name, Datum input, std::shared_ptr AssertArraysEqual(*expected, *actual, /*verbose=*/true); } -void CheckScalarBinary(std::string func_name, std::shared_ptr left_input, - std::shared_ptr right_input, - std::shared_ptr expected, const FunctionOptions* options) { - CheckScalar(std::move(func_name), {left_input, right_input}, expected, options); -} - -void CheckScalarBinary(std::string func_name, std::shared_ptr left_input, - std::shared_ptr right_input, - std::shared_ptr expected, const FunctionOptions* options) { - CheckScalar(std::move(func_name), {left_input, right_input}, expected, options); -} - -void CheckScalarBinary(std::string func_name, std::shared_ptr left_input, - std::shared_ptr right_input, - std::shared_ptr expected, const FunctionOptions* options) { - CheckScalar(std::move(func_name), {left_input, right_input}, expected, options); -} - -void CheckScalarBinary(std::string func_name, std::shared_ptr left_input, - std::shared_ptr right_input, - std::shared_ptr expected, const FunctionOptions* options) { +void CheckScalarBinary(std::string func_name, Datum left_input, Datum right_input, + Datum expected, const FunctionOptions* options) { CheckScalar(std::move(func_name), {left_input, right_input}, expected, options); } diff --git a/cpp/src/arrow/compute/kernels/test_util.h b/cpp/src/arrow/compute/kernels/test_util.h index c366b99a71d..eecedb64317 100644 --- a/cpp/src/arrow/compute/kernels/test_util.h +++ b/cpp/src/arrow/compute/kernels/test_util.h @@ -78,33 +78,11 @@ void CheckScalarUnary(std::string func_name, std::shared_ptr in_ty, std::string json_expected, const FunctionOptions* options = nullptr); -void CheckScalarUnary(std::string func_name, std::shared_ptr input, - std::shared_ptr expected, +void CheckScalarUnary(std::string func_name, Datum input, Datum expected, const FunctionOptions* options = nullptr); -void CheckScalarUnary(std::string func_name, std::shared_ptr input, - std::shared_ptr expected, - const FunctionOptions* options = nullptr); - -void CheckScalarBinary(std::string func_name, std::shared_ptr left_input, - std::shared_ptr right_input, - std::shared_ptr expected, - const FunctionOptions* options = nullptr); - -void CheckScalarBinary(std::string func_name, std::shared_ptr left_input, - std::shared_ptr right_input, - std::shared_ptr expected, - const FunctionOptions* options = nullptr); - -void CheckScalarBinary(std::string func_name, std::shared_ptr left_input, - std::shared_ptr right_input, - std::shared_ptr expected, - const FunctionOptions* options = nullptr); - -void CheckScalarBinary(std::string func_name, std::shared_ptr left_input, - std::shared_ptr right_input, - std::shared_ptr expected, - const FunctionOptions* options = nullptr); +void CheckScalarBinary(std::string func_name, Datum left_input, Datum right_input, + Datum expected, const FunctionOptions* options = nullptr); void CheckVectorUnary(std::string func_name, Datum input, std::shared_ptr expected, const FunctionOptions* options = nullptr);