(
array: &MapArray,
random_state: &RandomState,
hashes_buffer: &mut [u64],
)
| 570 | // only adding this `cfg` b/c this function is only used with this `cfg` |
| 571 | #[cfg(not(feature = "force_hash_collisions"))] |
| 572 | fn hash_map_array( |
| 573 | array: &MapArray, |
| 574 | random_state: &RandomState, |
| 575 | hashes_buffer: &mut [u64], |
| 576 | ) -> Result<()> { |
| 577 | let nulls = array.nulls(); |
| 578 | let offsets = array.offsets(); |
| 579 | |
| 580 | // Create hashes for each entry in each row |
| 581 | let first_offset = offsets.first().copied().unwrap_or_default() as usize; |
| 582 | let last_offset = offsets.last().copied().unwrap_or_default() as usize; |
| 583 | let entries_len = last_offset - first_offset; |
| 584 | |
| 585 | // Only hash the entries that are actually referenced |
| 586 | let mut values_hashes = vec![0u64; entries_len]; |
| 587 | let entries = array.entries(); |
| 588 | let sliced_columns: Vec<ArrayRef> = entries |
| 589 | .columns() |
| 590 | .iter() |
| 591 | .map(|col| col.slice(first_offset, entries_len)) |
| 592 | .collect(); |
| 593 | create_hashes(&sliced_columns, random_state, &mut values_hashes)?; |
| 594 | |
| 595 | // Combine the hashes for entries on each row with each other and previous hash for that row |
| 596 | // Adjust indices by first_offset since values_hashes is sliced starting from first_offset |
| 597 | if let Some(nulls) = nulls { |
| 598 | for (i, (start, stop)) in offsets.iter().zip(offsets.iter().skip(1)).enumerate() { |
| 599 | if nulls.is_valid(i) { |
| 600 | let hash = &mut hashes_buffer[i]; |
| 601 | for values_hash in &values_hashes |
| 602 | [start.as_usize() - first_offset..stop.as_usize() - first_offset] |
| 603 | { |
| 604 | *hash = combine_hashes(*hash, *values_hash); |
| 605 | } |
| 606 | } |
| 607 | } |
| 608 | } else { |
| 609 | for (i, (start, stop)) in offsets.iter().zip(offsets.iter().skip(1)).enumerate() { |
| 610 | let hash = &mut hashes_buffer[i]; |
| 611 | for values_hash in &values_hashes |
| 612 | [start.as_usize() - first_offset..stop.as_usize() - first_offset] |
| 613 | { |
| 614 | *hash = combine_hashes(*hash, *values_hash); |
| 615 | } |
| 616 | } |
| 617 | } |
| 618 | |
| 619 | Ok(()) |
| 620 | } |
| 621 | |
| 622 | #[cfg(not(feature = "force_hash_collisions"))] |
| 623 | fn hash_list_array<OffsetSize>( |
nothing calls this directly
no test coverage detected
searching dependent graphs…