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