MCPcopy Create free account
hub / github.com/apache/arrow / MakeMinOrMaxKernel

Function MakeMinOrMaxKernel

cpp/src/arrow/compute/kernels/hash_aggregate.cc:643–665  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

641
642template <MinOrMax min_or_max>
643HashAggregateKernel MakeMinOrMaxKernel(HashAggregateFunction* min_max_func) {
644 HashAggregateKernel kernel;
645 kernel.init = [min_max_func](
646 KernelContext* ctx,
647 const KernelInitArgs& args) -> Result<std::unique_ptr<KernelState>> {
648 std::vector<TypeHolder> inputs = args.inputs;
649 ARROW_ASSIGN_OR_RAISE(auto kernel, min_max_func->DispatchExact(args.inputs));
650 KernelInitArgs new_args{kernel, inputs, args.options};
651 return kernel->init(ctx, new_args);
652 };
653 kernel.signature =
654 KernelSignature::Make({InputType::Any(), Type::UINT32}, OutputType(FirstType));
655 kernel.resize = HashAggregateResize;
656 kernel.consume = HashAggregateConsume;
657 kernel.merge = HashAggregateMerge;
658 kernel.finalize = [](KernelContext* ctx, Datum* out) {
659 ARROW_ASSIGN_OR_RAISE(Datum temp,
660 checked_cast<GroupedAggregator*>(ctx->state())->Finalize());
661 *out = temp.array_as<StructArray>()->field(static_cast<uint8_t>(min_or_max));
662 return Status::OK();
663 };
664 return kernel;
665}
666
667struct GroupedMinMaxFactory {
668 template <typename T>

Callers

nothing calls this directly

Calls 6

OutputTypeFunction · 0.85
MakeFunction · 0.50
AnyFunction · 0.50
OKFunction · 0.50
initMethod · 0.45
fieldMethod · 0.45

Tested by

no test coverage detected