Skip to content

Commit

Permalink
simplify code
Browse files Browse the repository at this point in the history
  • Loading branch information
findepi committed Nov 23, 2024
1 parent 28e3b99 commit 69136a2
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions datafusion/common/src/hash_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,20 +321,15 @@ fn hash_fixed_list_array(
hashes_buffer: &mut [u64],
) -> Result<()> {
let values = Arc::clone(array.values());
let value_len = array.value_length();
let offset_size = if array.len() == 0 {
0
} else {
value_len as usize / array.len()
};
let value_length = array.value_length() as usize;
let nulls = array.nulls();
let mut values_hashes = vec![0u64; values.len()];
create_hashes(&[values], random_state, &mut values_hashes)?;
if let Some(nulls) = nulls {
for i in 0..array.len() {
if nulls.is_valid(i) {
let hash = &mut hashes_buffer[i];
for values_hash in &values_hashes[i * offset_size..(i + 1) * offset_size]
for values_hash in &values_hashes[i * value_length..(i + 1) * value_length]
{
*hash = combine_hashes(*hash, *values_hash);
}
Expand All @@ -343,7 +338,7 @@ fn hash_fixed_list_array(
} else {
for i in 0..array.len() {
let hash = &mut hashes_buffer[i];
for values_hash in &values_hashes[i * offset_size..(i + 1) * offset_size] {
for values_hash in &values_hashes[i * value_length..(i + 1) * value_length] {
*hash = combine_hashes(*hash, *values_hash);
}
}
Expand Down

0 comments on commit 69136a2

Please sign in to comment.