| 65 | } |
| 66 | |
| 67 | Result<const HashAggregateKernel*> GetKernel(ExecContext* ctx, const Aggregate& aggregate, |
| 68 | const std::vector<TypeHolder>& in_types) { |
| 69 | const auto aggr_in_types = ExtendWithGroupIdType(in_types); |
| 70 | ARROW_ASSIGN_OR_RAISE(auto function, |
| 71 | ctx->func_registry()->GetFunction(aggregate.function)); |
| 72 | if (function->kind() != Function::HASH_AGGREGATE) { |
| 73 | if (function->kind() == Function::SCALAR_AGGREGATE) { |
| 74 | return Status::Invalid("The provided function (", aggregate.function, |
| 75 | ") is a scalar aggregate function. Since there are " |
| 76 | "keys to group by, a hash aggregate function was " |
| 77 | "expected (normally these start with hash_)"); |
| 78 | } |
| 79 | return Status::Invalid("The provided function(", aggregate.function, |
| 80 | ") is not an aggregate function"); |
| 81 | } |
| 82 | ARROW_ASSIGN_OR_RAISE(const Kernel* kernel, function->DispatchExact(aggr_in_types)); |
| 83 | return static_cast<const HashAggregateKernel*>(kernel); |
| 84 | } |
| 85 | |
| 86 | Result<std::unique_ptr<KernelState>> InitKernel(const HashAggregateKernel* kernel, |
| 87 | ExecContext* ctx, |
no test coverage detected