| 1135 | |
| 1136 | template <typename T> |
| 1137 | Result<std::unique_ptr<KernelState>> FirstLastInit(KernelContext* ctx, |
| 1138 | const KernelInitArgs& args) { |
| 1139 | ARROW_ASSIGN_OR_RAISE(auto impl, HashAggregateInit<GroupedFirstLastImpl<T>>(ctx, args)); |
| 1140 | static_cast<GroupedFirstLastImpl<T>*>(impl.get())->type_ = |
| 1141 | args.inputs[0].GetSharedPtr(); |
| 1142 | return impl; |
| 1143 | } |
| 1144 | |
| 1145 | template <FirstOrLast first_or_last> |
| 1146 | HashAggregateKernel MakeFirstOrLastKernel(HashAggregateFunction* first_last_func) { |