2424
2525namespace arrow {
2626namespace compute {
27- namespace aggregate {
27+
28+ namespace {
2829
2930void AggregateConsume (KernelContext* ctx, const ExecBatch& batch) {
3031 checked_cast<ScalarAggregator*>(ctx->state ())->Consume (ctx, batch);
@@ -38,6 +39,19 @@ void AggregateFinalize(KernelContext* ctx, Datum* out) {
3839 checked_cast<ScalarAggregator*>(ctx->state ())->Finalize (ctx, out);
3940}
4041
42+ } // namespace
43+
44+ void AddAggKernel (std::shared_ptr<KernelSignature> sig, KernelInit init,
45+ ScalarAggregateFunction* func, SimdLevel::type simd_level) {
46+ ScalarAggregateKernel kernel (std::move (sig), init, AggregateConsume, AggregateMerge,
47+ AggregateFinalize);
48+ // Set the simd level
49+ kernel.simd_level = simd_level;
50+ DCHECK_OK (func->AddKernel (kernel));
51+ }
52+
53+ namespace aggregate {
54+
4155// ----------------------------------------------------------------------
4256// Count implementation
4357
@@ -137,15 +151,6 @@ std::unique_ptr<KernelState> MinMaxInit(KernelContext* ctx, const KernelInitArgs
137151 return visitor.Create ();
138152}
139153
140- void AddAggKernel (std::shared_ptr<KernelSignature> sig, KernelInit init,
141- ScalarAggregateFunction* func, SimdLevel::type simd_level) {
142- ScalarAggregateKernel kernel (std::move (sig), init, AggregateConsume, AggregateMerge,
143- AggregateFinalize);
144- // Set the simd level
145- kernel.simd_level = simd_level;
146- DCHECK_OK (func->AddKernel (kernel));
147- }
148-
149154void AddBasicAggKernels (KernelInit init,
150155 const std::vector<std::shared_ptr<DataType>>& types,
151156 std::shared_ptr<DataType> out_ty, ScalarAggregateFunction* func,
@@ -202,8 +207,8 @@ void RegisterScalarAggregateBasic(FunctionRegistry* registry) {
202207
203208 // Takes any array input, outputs int64 scalar
204209 InputType any_array (ValueDescr::ARRAY );
205- aggregate:: AddAggKernel (KernelSignature::Make ({any_array}, ValueDescr::Scalar (int64 ())),
206- aggregate::CountInit, func.get ());
210+ AddAggKernel (KernelSignature::Make ({any_array}, ValueDescr::Scalar (int64 ())),
211+ aggregate::CountInit, func.get ());
207212 DCHECK_OK (registry->AddFunction (std::move (func)));
208213
209214 func = std::make_shared<ScalarAggregateFunction>(" sum" , Arity::Unary (), &sum_doc);
@@ -263,10 +268,6 @@ void RegisterScalarAggregateBasic(FunctionRegistry* registry) {
263268#endif
264269
265270 DCHECK_OK (registry->AddFunction (std::move (func)));
266-
267- DCHECK_OK (registry->AddFunction (aggregate::AddModeAggKernels ()));
268- DCHECK_OK (registry->AddFunction (aggregate::AddStddevAggKernels ()));
269- DCHECK_OK (registry->AddFunction (aggregate::AddVarianceAggKernels ()));
270271}
271272
272273} // namespace internal
0 commit comments