| 84 | } |
| 85 | |
| 86 | Result<std::unique_ptr<KernelState>> InitKernel(const HashAggregateKernel* kernel, |
| 87 | ExecContext* ctx, |
| 88 | const Aggregate& aggregate, |
| 89 | const std::vector<TypeHolder>& in_types) { |
| 90 | const auto aggr_in_types = ExtendWithGroupIdType(in_types); |
| 91 | |
| 92 | KernelContext kernel_ctx{ctx}; |
| 93 | const auto* options = |
| 94 | arrow::internal::checked_cast<const FunctionOptions*>(aggregate.options.get()); |
| 95 | if (options == nullptr) { |
| 96 | // use known default options for the named function if possible |
| 97 | auto maybe_function = ctx->func_registry()->GetFunction(aggregate.function); |
| 98 | if (maybe_function.ok()) { |
| 99 | options = maybe_function.ValueOrDie()->default_options(); |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | ARROW_ASSIGN_OR_RAISE( |
| 104 | auto state, |
| 105 | kernel->init(&kernel_ctx, KernelInitArgs{kernel, aggr_in_types, options})); |
| 106 | return state; |
| 107 | } |
| 108 | |
| 109 | Result<std::vector<const HashAggregateKernel*>> GetKernels( |
| 110 | ExecContext* ctx, const std::vector<Aggregate>& aggregates, |
no test coverage detected