Describe the enhancement requested
The hash-based vector functions do not support halffloat input, while supporting all other numeric types:
>>> import pyarrow as pa
>>> pa.array([1.5, 2.5], type=pa.float16()).dictionary_encode()
ArrowNotImplementedError: Function 'dictionary_encode' has no kernel matching input types (halffloat)
unique and value_counts fail the same way. Reproduced on current main; platform-independent (missing kernel registration, not a platform issue).
The cause is that AddHashKernels() in cpp/src/arrow/compute/kernels/vector_hash.cc registers kernels by iterating PrimitiveTypes(), which excludes float16 (FloatingPointTypes() is only {float32(), float64()}), and GetHashInit() has no Type::HALF_FLOAT case.
This was previously part of the broader GH-43017 ("Make the set of casts and hash kernels involving float16 consistent with other floating types", closed as stale); its PR #43018 stalled on the cast/sort parts, not the hash-kernel part. This issue proposes fixing only the hash kernels, registering float16 explicitly the same way recent merged float16 additions did (#46446 for if_else/replace, #46286 for run_end_encode), i.e. without widening FloatingPointTypes()/NumericTypes()/PrimitiveTypes(), whose other consumers are templated on the uint16_t storage type and would miscompute for half floats.
Component(s)
C++
Describe the enhancement requested
The hash-based vector functions do not support
halffloatinput, while supporting all other numeric types:uniqueandvalue_countsfail the same way. Reproduced on currentmain; platform-independent (missing kernel registration, not a platform issue).The cause is that
AddHashKernels()incpp/src/arrow/compute/kernels/vector_hash.ccregisters kernels by iteratingPrimitiveTypes(), which excludes float16 (FloatingPointTypes()is only{float32(), float64()}), andGetHashInit()has noType::HALF_FLOATcase.This was previously part of the broader GH-43017 ("Make the set of casts and hash kernels involving float16 consistent with other floating types", closed as stale); its PR #43018 stalled on the cast/sort parts, not the hash-kernel part. This issue proposes fixing only the hash kernels, registering float16 explicitly the same way recent merged float16 additions did (#46446 for if_else/replace, #46286 for run_end_encode), i.e. without widening
FloatingPointTypes()/NumericTypes()/PrimitiveTypes(), whose other consumers are templated on theuint16_tstorage type and would miscompute for half floats.Component(s)
C++