This is an automated email from the ASF dual-hosted git repository.

westonpace pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 998cca30c7 ARROW-16948: [C++] Benchmark Aggregates Fails To Compile 
After Aggregate Updates (#13489)
998cca30c7 is described below

commit 998cca30c70a7e0bbc3f83957923f2e3019b314b
Author: Vibhatha Lakmal Abeykoon <[email protected]>
AuthorDate: Sat Jul 2 05:39:18 2022 +0530

    ARROW-16948: [C++] Benchmark Aggregates Fails To Compile After Aggregate 
Updates (#13489)
    
    This PR is a FIX for compilation issue in `aggregate_benchmark.cc` and 
possibly didn't covered by my previous PR on Aggregate simplification 
(https://issues.apache.org/jira/browse/ARROW-16549).
    
    PS: This wasn't compiled on Mac M1. In addition also think there could be a 
CI improvement that can be later on added to cover this. Open for discussion.
    
    Authored-by: Vibhatha Abeykoon <[email protected]>
    Signed-off-by: Weston Pace <[email protected]>
---
 cpp/src/arrow/compute/kernels/aggregate_benchmark.cc | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/cpp/src/arrow/compute/kernels/aggregate_benchmark.cc 
b/cpp/src/arrow/compute/kernels/aggregate_benchmark.cc
index a8cae5b50c..b1ece6bd7d 100644
--- a/cpp/src/arrow/compute/kernels/aggregate_benchmark.cc
+++ b/cpp/src/arrow/compute/kernels/aggregate_benchmark.cc
@@ -308,8 +308,24 @@ BENCHMARK_TEMPLATE(ReferenceSum, 
SumBitmapVectorizeUnroll<int64_t>)
 
 using arrow::compute::internal::GroupBy;
 
-static void BenchmarkGroupBy(benchmark::State& state, std::vector<Aggregate> 
aggregates,
+// The internal function GroupBy simulates an aggregate node and
+// doesn't need a target or name.  This helper class allows us to
+// just specify the fields we need and make up a dummy target / name.
+struct BenchmarkAggregate {
+  std::string function;
+  std::shared_ptr<FunctionOptions> options;
+};
+
+static void BenchmarkGroupBy(benchmark::State& state,
+                             std::vector<BenchmarkAggregate> bench_aggregates,
                              std::vector<Datum> arguments, std::vector<Datum> 
keys) {
+  std::vector<Aggregate> aggregates;
+  aggregates.reserve(bench_aggregates.size());
+  int idx = 0;
+  for (const auto& b_agg : bench_aggregates) {
+    aggregates.push_back({b_agg.function, std::move(b_agg.options),
+                          "agg_" + std::to_string(idx++), b_agg.function});
+  }
   for (auto _ : state) {
     ABORT_NOT_OK(GroupBy(arguments, keys, aggregates).status());
   }

Reply via email to