| 695 | |
| 696 | template <typename Action> |
| 697 | void AddHashKernels(VectorFunction* func, VectorKernel base, OutputType out_ty) { |
| 698 | for (const auto& ty : PrimitiveTypes()) { |
| 699 | base.init = GetHashInit<Action>(ty->id()); |
| 700 | base.signature = KernelSignature::Make({ty}, out_ty); |
| 701 | DCHECK_OK(func->AddKernel(base)); |
| 702 | } |
| 703 | |
| 704 | // float16() is not part of PrimitiveTypes() (FloatingPointTypes() only covers |
| 705 | // float32 and float64; see GH-43017), so it must be registered explicitly. Like |
| 706 | // float32 and float64, it is hashed by its raw bit pattern (via UInt16Type). |
| 707 | base.init = GetHashInit<Action>(Type::HALF_FLOAT); |
| 708 | base.signature = KernelSignature::Make({float16()}, out_ty); |
| 709 | DCHECK_OK(func->AddKernel(base)); |
| 710 | |
| 711 | // Parametric types that we want matching to be dependent only on type id |
| 712 | auto parametric_types = {Type::TIME32, Type::TIME64, Type::TIMESTAMP, Type::DURATION, |
| 713 | Type::FIXED_SIZE_BINARY}; |
| 714 | for (const auto& type_id : parametric_types) { |
| 715 | base.init = GetHashInit<Action>(type_id); |
| 716 | base.signature = KernelSignature::Make({type_id}, out_ty); |
| 717 | DCHECK_OK(func->AddKernel(base)); |
| 718 | } |
| 719 | |
| 720 | for (auto t : {Type::DECIMAL128, Type::DECIMAL256}) { |
| 721 | base.init = GetHashInit<Action>(t); |
| 722 | base.signature = KernelSignature::Make({t}, out_ty); |
| 723 | DCHECK_OK(func->AddKernel(base)); |
| 724 | } |
| 725 | |
| 726 | for (const auto& ty : IntervalTypes()) { |
| 727 | base.init = GetHashInit<Action>(ty->id()); |
| 728 | base.signature = KernelSignature::Make({ty}, out_ty); |
| 729 | DCHECK_OK(func->AddKernel(base)); |
| 730 | } |
| 731 | } |
| 732 | |
| 733 | const FunctionDoc unique_doc("Compute unique elements", |
| 734 | ("Return an array with distinct values.\n" |