This is an automated email from the ASF dual-hosted git repository.
dheres pushed a commit to branch create_hashes_primitive
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git
The following commit(s) were added to refs/heads/create_hashes_primitive by
this push:
new 5a72ee7262 Add docs, assertion
5a72ee7262 is described below
commit 5a72ee726202ae59260c19777dd2dab92521d75c
Author: Daniƫl Heres <[email protected]>
AuthorDate: Sun Jul 2 20:03:59 2023 +0200
Add docs, assertion
---
datafusion/physical-expr/src/hash_utils.rs | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/datafusion/physical-expr/src/hash_utils.rs
b/datafusion/physical-expr/src/hash_utils.rs
index 39f6e3ff52..9cdb2ce5c5 100644
--- a/datafusion/physical-expr/src/hash_utils.rs
+++ b/datafusion/physical-expr/src/hash_utils.rs
@@ -84,6 +84,9 @@ macro_rules! hash_float_value {
}
hash_float_value!((half::f16, u16), (f32, u32), (f64, u64));
+/// Builds hash values of PrimitiveArray and writes them into `hashes_buffer`
+/// If `rehash==true` this combines the previous hash value in the buffer
+/// with the new hash using `combine_hashes`
fn hash_array_primitive<T>(
array: &PrimitiveArray<T>,
random_state: &RandomState,
@@ -120,6 +123,9 @@ fn hash_array_primitive<T>(
}
}
+/// Hashes one array into the `hashes_buffer`
+/// If `rehash==true` this combines the previous hash value in the buffer
+/// with the new hash using `combine_hashes`
fn hash_array<T>(
array: T,
random_state: &RandomState,
@@ -129,6 +135,8 @@ fn hash_array<T>(
T: ArrayAccessor,
T::Item: HashValue,
{
+ assert_eq!(hashes_buffer.len(), array.len(), "hashes_buffer and array
should be of equal length");
+
if array.null_count() == 0 {
if rehash {
for (i, hash) in hashes_buffer.iter_mut().enumerate() {