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

Function NewModeKernel

cpp/src/arrow/compute/kernels/aggregate_mode.cc:452–474  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

450}
451
452VectorKernel NewModeKernel(const std::shared_ptr<DataType>& in_type, ArrayKernelExec exec,
453 VectorKernel::ChunkedExec exec_chunked) {
454 VectorKernel kernel;
455 kernel.init = ModeState::Init;
456 kernel.can_execute_chunkwise = false;
457 kernel.output_chunked = false;
458 switch (in_type->id()) {
459 case Type::DECIMAL128:
460 case Type::DECIMAL256:
461 kernel.signature =
462 KernelSignature::Make({InputType(in_type->id())}, OutputType(ModeType));
463 break;
464 default: {
465 auto out_type =
466 struct_({field(kModeFieldName, in_type), field(kCountFieldName, int64())});
467 kernel.signature = KernelSignature::Make({in_type->id()}, std::move(out_type));
468 break;
469 }
470 }
471 kernel.exec = std::move(exec);
472 kernel.exec_chunked = exec_chunked;
473 return kernel;
474}
475
476const FunctionDoc mode_doc{
477 "Compute the modal (most common) values of a numeric array",

Callers 1

Calls 6

InputTypeFunction · 0.85
OutputTypeFunction · 0.85
struct_Function · 0.85
MakeFunction · 0.50
fieldFunction · 0.50
idMethod · 0.45

Tested by

no test coverage detected