(
array: &PrimitiveArray<P>,
hashes: &mut [u64],
transform: F,
hash_method: H,
)
| 32 | /// value into a byte slice before feeding it to `hash_method`. |
| 33 | #[inline] |
| 34 | pub(crate) fn hash_primitive_values<P, F, B, H>( |
| 35 | array: &PrimitiveArray<P>, |
| 36 | hashes: &mut [u64], |
| 37 | transform: F, |
| 38 | hash_method: H, |
| 39 | ) where |
| 40 | P: ArrowPrimitiveType, |
| 41 | F: Fn(P::Native) -> B, |
| 42 | B: AsRef<[u8]>, |
| 43 | H: Fn(B, u64) -> u64, |
| 44 | { |
| 45 | let values = array.values(); |
| 46 | if array.null_count() == 0 { |
| 47 | // Fast path: no nulls, skip null checks |
| 48 | for (i, hash) in hashes.iter_mut().enumerate() { |
| 49 | *hash = hash_method(transform(values[i]), *hash); |
| 50 | } |
| 51 | } else { |
| 52 | // Slow path: check each row for null |
| 53 | for (i, hash) in hashes.iter_mut().enumerate() { |
| 54 | if !array.is_null(i) { |
| 55 | *hash = hash_method(transform(values[i]), *hash); |
| 56 | } |
| 57 | } |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | /// Hash an array by calling `value_at(array, i)` to produce a byte slice for |
| 62 | /// each non-null row. Used for byte-slice arrays (Utf8/Binary/FixedSizeBinary |
nothing calls this directly
no test coverage detected
searching dependent graphs…