felipecrv commented on code in PR #15083:
URL: https://github.com/apache/arrow/pull/15083#discussion_r1063471507
##########
cpp/src/arrow/compute/exec/aggregate.cc:
##########
@@ -38,33 +38,38 @@ namespace internal {
Result<std::vector<const HashAggregateKernel*>> GetKernels(
ExecContext* ctx, const std::vector<Aggregate>& aggregates,
- const std::vector<TypeHolder>& in_types) {
+ const std::vector<std::vector<TypeHolder>>& in_types) {
if (aggregates.size() != in_types.size()) {
return Status::Invalid(aggregates.size(), " aggregate functions were
specified but ",
in_types.size(), " arguments were provided.");
}
std::vector<const HashAggregateKernel*> kernels(in_types.size());
+ std::vector<TypeHolder> aggregate_in_types;
Review Comment:
Given that this is the loop body:
```cpp
// {in_types[i]..., uint32()}
aggregate_in_types = in_types[i];
aggregate_in_types.emplace_back(uint32());
```
do you prefer a `.reserve(2)` for the common case of `in_types[i].size() ==
1` or should I reserve within the loop body like this?
```diff
// {in_types[i]..., uint32()}
+ aggregate_in_types.reserve(in_types[i].size() + 1);
aggregate_in_types = in_types[i];
aggregate_in_types.emplace_back(uint32());
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]