MCPcopy Create free account
hub / github.com/apache/arrow / BenchmarkSegmentedAggregate

Function BenchmarkSegmentedAggregate

cpp/src/arrow/acero/aggregate_benchmark.cc:895–910  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

893//
894
895static void BenchmarkSegmentedAggregate(
896 benchmark::State& state, int64_t num_rows, std::vector<Aggregate> aggregates,
897 const std::vector<std::shared_ptr<Array>>& arguments,
898 const std::vector<std::shared_ptr<Array>>& keys, int64_t num_segment_keys,
899 int64_t num_segments) {
900 ASSERT_GT(num_segments, 0);
901
902 auto rng = random::RandomArrayGenerator(42);
903 auto segment_key = rng.Int64(num_rows, /*min=*/0, /*max=*/num_segments - 1);
904 int64_t* values = segment_key->data()->GetMutableValues<int64_t>(1);
905 std::sort(values, values + num_rows);
906 // num_segment_keys copies of the segment key.
907 ArrayVector segment_keys(num_segment_keys, segment_key);
908
909 BenchmarkAggregate(state, std::move(aggregates), arguments, keys, segment_keys);
910}
911
912static void CountScalarSegmentedByInts(benchmark::State& state) {
913 constexpr int64_t num_rows = 32 * 1024;

Callers 2

Calls 3

BenchmarkAggregateFunction · 0.85
Int64Method · 0.45
dataMethod · 0.45

Tested by

no test coverage detected