| 893 | // |
| 894 | |
| 895 | static 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 | |
| 912 | static void CountScalarSegmentedByInts(benchmark::State& state) { |
| 913 | constexpr int64_t num_rows = 32 * 1024; |
no test coverage detected