Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions cpp/src/arrow/compute/kernels/vector_hash.cc
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,7 @@ KernelInit GetHashInit(Type::type type_id) {
return HashInit<RegularHashKernel<UInt8Type, Action>>;
case Type::INT16:
case Type::UINT16:
case Type::HALF_FLOAT:
return HashInit<RegularHashKernel<UInt16Type, Action>>;
case Type::INT32:
case Type::UINT32:
Expand Down Expand Up @@ -700,6 +701,13 @@ void AddHashKernels(VectorFunction* func, VectorKernel base, OutputType out_ty)
DCHECK_OK(func->AddKernel(base));
}

// float16() is not part of PrimitiveTypes() (FloatingPointTypes() only covers
Comment thread
fornwall marked this conversation as resolved.
// float32 and float64; see GH-43017), so it must be registered explicitly. Like
// float32 and float64, it is hashed by its raw bit pattern (via UInt16Type).
base.init = GetHashInit<Action>(Type::HALF_FLOAT);
base.signature = KernelSignature::Make({float16()}, out_ty);
DCHECK_OK(func->AddKernel(base));

// Parametric types that we want matching to be dependent only on type id
auto parametric_types = {Type::TIME32, Type::TIME64, Type::TIMESTAMP, Type::DURATION,
Type::FIXED_SIZE_BINARY};
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/arrow/compute/kernels/vector_hash_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ template <typename Type>
class TestHashKernelPrimitive : public ::testing::Test {};

typedef ::testing::Types<Int8Type, UInt8Type, Int16Type, UInt16Type, Int32Type,
UInt32Type, Int64Type, UInt64Type, FloatType, DoubleType,
Date32Type, Date64Type>
UInt32Type, Int64Type, UInt64Type, HalfFloatType, FloatType,
DoubleType, Date32Type, Date64Type>
PrimitiveDictionaries;

TYPED_TEST_SUITE(TestHashKernelPrimitive, PrimitiveDictionaries);
Expand Down