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

Function RegisterHashAggregateBasic

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

Source from the content-addressed store, hash-verified

2338} // namespace
2339
2340void RegisterHashAggregateBasic(FunctionRegistry* registry) {
2341 static const auto default_count_options = CountOptions::Defaults();
2342 static const auto default_scalar_aggregate_options = ScalarAggregateOptions::Defaults();
2343 static const auto default_tdigest_options = TDigestOptions::Defaults();
2344 static const auto default_variance_options = VarianceOptions::Defaults();
2345 static const auto default_skew_options = SkewOptions::Defaults();
2346
2347 {
2348 auto func = std::make_shared<HashAggregateFunction>(
2349 "hash_count", Arity::Binary(), hash_count_doc, &default_count_options);
2350
2351 DCHECK_OK(func->AddKernel(
2352 MakeKernel(InputType::Any(), HashAggregateInit<GroupedCountImpl>)));
2353 DCHECK_OK(registry->AddFunction(std::move(func)));
2354 }
2355
2356 {
2357 auto func = std::make_shared<HashAggregateFunction>("hash_count_all", Arity::Unary(),
2358 hash_count_all_doc, NULLPTR);
2359
2360 DCHECK_OK(func->AddKernel(MakeUnaryKernel(HashAggregateInit<GroupedCountAllImpl>)));
2361 auto status = registry->AddFunction(std::move(func));
2362 DCHECK_OK(status);
2363 }
2364
2365 HashAggregateFunction* first_last_func = nullptr;
2366 {
2367 auto func = std::make_shared<HashAggregateFunction>(
2368 "hash_first_last", Arity::Binary(), hash_first_last_doc,
2369 &default_scalar_aggregate_options);
2370
2371 DCHECK_OK(
2372 AddHashAggKernels(NumericTypes(), GroupedFirstLastFactory::Make, func.get()));
2373 DCHECK_OK(
2374 AddHashAggKernels(TemporalTypes(), GroupedFirstLastFactory::Make, func.get()));
2375 DCHECK_OK(
2376 AddHashAggKernels(BaseBinaryTypes(), GroupedFirstLastFactory::Make, func.get()));
2377 DCHECK_OK(AddHashAggKernels({boolean(), fixed_size_binary(1)},
2378 GroupedFirstLastFactory::Make, func.get()));
2379
2380 first_last_func = func.get();
2381 DCHECK_OK(registry->AddFunction(std::move(func)));
2382 }
2383
2384 {
2385 auto func = std::make_shared<HashAggregateFunction>(
2386 "hash_first", Arity::Binary(), hash_first_doc, &default_scalar_aggregate_options);
2387 DCHECK_OK(
2388 func->AddKernel(MakeFirstOrLastKernel<FirstOrLast::First>(first_last_func)));
2389 DCHECK_OK(registry->AddFunction(std::move(func)));
2390 }
2391
2392 {
2393 auto func = std::make_shared<HashAggregateFunction>(
2394 "hash_last", Arity::Binary(), hash_last_doc, &default_scalar_aggregate_options);
2395 DCHECK_OK(func->AddKernel(MakeFirstOrLastKernel<FirstOrLast::Last>(first_last_func)));
2396 DCHECK_OK(registry->AddFunction(std::move(func)));
2397 }

Callers 1

RegisterComputeKernelsFunction · 0.85

Calls 14

MakeKernelFunction · 0.85
UnaryFunction · 0.85
MakeUnaryKernelFunction · 0.85
AddHashAggKernelsFunction · 0.85
fixed_size_binaryFunction · 0.85
decimal256Function · 0.85
month_intervalFunction · 0.85
DefaultsFunction · 0.50
BinaryFunction · 0.50
AnyFunction · 0.50
decimal128Function · 0.50
AddKernelMethod · 0.45

Tested by

no test coverage detected