Skip to content

Commit

Permalink
apacheGH-45279: [C++][Compute] Move all Grouper tests to grouper_test…
Browse files Browse the repository at this point in the history
….cc (apache#45280)

### What changes are included in this PR?

1. Move tests for the Grouper and RowSegmenter implementations to `arrow/compute/row/grouper_test.cc` where they belong (this also makes `acero/hash_aggregate_test.cc` slightly shorter)
2. Introduce a `arrow_compute_testing` object library to hold compute-related testing utilities
3. Remove duplicate definitions of `ExecBatchFromJSON` from Dataset and Acero
4. Make `arrow/compute/kernels/test_util.h` internal

### Are these changes tested?

Yes, by existing tests and CI.

### Are there any user-facing changes?

No.

* GitHub Issue: apache#45279

Authored-by: Antoine Pitrou <[email protected]>
Signed-off-by: Antoine Pitrou <[email protected]>
  • Loading branch information
pitrou authored Jan 16, 2025
1 parent e434536 commit df82d4c
Show file tree
Hide file tree
Showing 56 changed files with 1,226 additions and 1,193 deletions.
2 changes: 1 addition & 1 deletion cpp/src/arrow/acero/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ if(ARROW_TESTING)
if(ARROW_WITH_OPENTELEMETRY)
target_link_libraries(arrow_acero_testing PRIVATE ${ARROW_OPENTELEMETRY_LIBS})
endif()
list(APPEND ARROW_ACERO_TEST_LINK_LIBS arrow_acero_testing)
list(APPEND ARROW_ACERO_TEST_LINK_LIBS arrow_acero_testing arrow_compute_testing)
endif()
# Only for hash_aggregate_test.cc.
if(ARROW_USE_BOOST)
Expand Down
1 change: 1 addition & 0 deletions cpp/src/arrow/acero/aggregate_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include "arrow/acero/visibility.h"
#include "arrow/compute/api_aggregate.h"
#include "arrow/compute/test_util_internal.h"
#include "arrow/compute/type_fwd.h"
#include "arrow/result.h"
#include "arrow/type_fwd.h"
Expand Down
3 changes: 3 additions & 0 deletions cpp/src/arrow/acero/aggregate_node_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include "arrow/acero/test_util_internal.h"
#include "arrow/compute/api_aggregate.h"
#include "arrow/compute/test_util_internal.h"
#include "arrow/result.h"
#include "arrow/table.h"
#include "arrow/testing/gtest_util.h"
Expand All @@ -32,6 +33,8 @@

namespace arrow {

using compute::ExecBatchFromJSON;

namespace acero {

Result<std::shared_ptr<Table>> TableGroupBy(
Expand Down
4 changes: 3 additions & 1 deletion cpp/src/arrow/acero/asof_join_node_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@
#include "arrow/acero/util.h"
#include "arrow/api.h"
#include "arrow/compute/api_scalar.h"
#include "arrow/compute/kernels/test_util.h"
#include "arrow/compute/cast.h"
#include "arrow/compute/row/row_encoder_internal.h"
#include "arrow/compute/test_util_internal.h"
#include "arrow/testing/gtest_util.h"
#include "arrow/testing/matchers.h"
#include "arrow/testing/random.h"
Expand All @@ -67,6 +68,7 @@ namespace arrow {

using compute::Cast;
using compute::Divide;
using compute::ExecBatchFromJSON;
using compute::Multiply;
using compute::Subtract;

Expand Down
Loading

0 comments on commit df82d4c

Please sign in to comment.