(
array: &UnionArray,
random_state: &RandomState,
hashes_buffer: &mut [u64],
)
| 711 | |
| 712 | #[cfg(not(feature = "force_hash_collisions"))] |
| 713 | fn hash_union_array( |
| 714 | array: &UnionArray, |
| 715 | random_state: &RandomState, |
| 716 | hashes_buffer: &mut [u64], |
| 717 | ) -> Result<()> { |
| 718 | let DataType::Union(union_fields, _mode) = array.data_type() else { |
| 719 | unreachable!() |
| 720 | }; |
| 721 | |
| 722 | if array.is_dense() { |
| 723 | // Dense union: children only contain values of their type, so they're already compact. |
| 724 | // Use the default hashing approach which is efficient for dense unions. |
| 725 | hash_union_array_default(array, union_fields, random_state, hashes_buffer) |
| 726 | } else { |
| 727 | // Sparse union: each child has the same length as the union array. |
| 728 | // Optimization: only hash the elements that are actually referenced by type_ids, |
| 729 | // instead of hashing all K*N elements (where K = num types, N = array length). |
| 730 | hash_sparse_union_array(array, union_fields, random_state, hashes_buffer) |
| 731 | } |
| 732 | } |
| 733 | |
| 734 | /// Default hashing for union arrays - hashes all elements of each child array fully. |
| 735 | /// |
nothing calls this directly
no test coverage detected
searching dependent graphs…