Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cpp/src/arrow/compute/kernels/scalar_string_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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])");
Expand Down
36 changes: 6 additions & 30 deletions cpp/src/arrow/compute/kernels/test_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,10 @@ void CheckScalar(std::string func_name, const DatumVector& inputs, Datum expecte
}
}

void CheckScalarUnary(std::string func_name, std::shared_ptr<Array> input,
std::shared_ptr<Array> 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<Datum> input_vector = {std::move(input)};
CheckScalar(std::move(func_name), input_vector, expected, options);
}

void CheckScalarUnary(std::string func_name, std::shared_ptr<DataType> in_ty,
Expand All @@ -187,11 +187,6 @@ void CheckScalarUnary(std::string func_name, std::shared_ptr<DataType> in_ty,
ArrayFromJSON(out_ty, json_expected), options);
}

void CheckScalarUnary(std::string func_name, std::shared_ptr<Scalar> input,
std::shared_ptr<Scalar> expected, const FunctionOptions* options) {
CheckScalar(std::move(func_name), {input}, expected, options);
}

void CheckVectorUnary(std::string func_name, Datum input, std::shared_ptr<Array> expected,
const FunctionOptions* options) {
ASSERT_OK_AND_ASSIGN(Datum out, CallFunction(func_name, {input}, options));
Expand All @@ -200,27 +195,8 @@ void CheckVectorUnary(std::string func_name, Datum input, std::shared_ptr<Array>
AssertArraysEqual(*expected, *actual, /*verbose=*/true);
}

void CheckScalarBinary(std::string func_name, std::shared_ptr<Scalar> left_input,
std::shared_ptr<Scalar> right_input,
std::shared_ptr<Scalar> expected, const FunctionOptions* options) {
CheckScalar(std::move(func_name), {left_input, right_input}, expected, options);
}

void CheckScalarBinary(std::string func_name, std::shared_ptr<Array> left_input,
std::shared_ptr<Array> right_input,
std::shared_ptr<Array> expected, const FunctionOptions* options) {
CheckScalar(std::move(func_name), {left_input, right_input}, expected, options);
}

void CheckScalarBinary(std::string func_name, std::shared_ptr<Array> left_input,
std::shared_ptr<Scalar> right_input,
std::shared_ptr<Array> expected, const FunctionOptions* options) {
CheckScalar(std::move(func_name), {left_input, right_input}, expected, options);
}

void CheckScalarBinary(std::string func_name, std::shared_ptr<Scalar> left_input,
std::shared_ptr<Array> right_input,
std::shared_ptr<Array> 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);
}

Expand Down
28 changes: 3 additions & 25 deletions cpp/src/arrow/compute/kernels/test_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,33 +78,11 @@ void CheckScalarUnary(std::string func_name, std::shared_ptr<DataType> in_ty,
std::string json_expected,
const FunctionOptions* options = nullptr);

void CheckScalarUnary(std::string func_name, std::shared_ptr<Array> input,
std::shared_ptr<Array> expected,
void CheckScalarUnary(std::string func_name, Datum input, Datum expected,
const FunctionOptions* options = nullptr);

void CheckScalarUnary(std::string func_name, std::shared_ptr<Scalar> input,
std::shared_ptr<Scalar> expected,
const FunctionOptions* options = nullptr);

void CheckScalarBinary(std::string func_name, std::shared_ptr<Scalar> left_input,
std::shared_ptr<Scalar> right_input,
std::shared_ptr<Scalar> expected,
const FunctionOptions* options = nullptr);

void CheckScalarBinary(std::string func_name, std::shared_ptr<Array> left_input,
std::shared_ptr<Array> right_input,
std::shared_ptr<Array> expected,
const FunctionOptions* options = nullptr);

void CheckScalarBinary(std::string func_name, std::shared_ptr<Array> left_input,
std::shared_ptr<Scalar> right_input,
std::shared_ptr<Array> expected,
const FunctionOptions* options = nullptr);

void CheckScalarBinary(std::string func_name, std::shared_ptr<Scalar> left_input,
std::shared_ptr<Array> right_input,
std::shared_ptr<Array> 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<Array> expected,
const FunctionOptions* options = nullptr);
Expand Down