friendlymatthew commented on code in PR #18718:
URL: https://github.com/apache/datafusion/pull/18718#discussion_r2529146034


##########
datafusion/common/src/hash_utils.rs:
##########
@@ -329,6 +329,40 @@ where
     Ok(())
 }
 
+#[cfg(not(feature = "force_hash_collisions"))]
+fn hash_union_array(
+    array: &UnionArray,
+    random_state: &RandomState,
+    hashes_buffer: &mut [u64],
+) -> Result<()> {
+    let DataType::Union(union_fields, _mode) = array.data_type() else {
+        unreachable!()
+    };
+
+    let mut child_hashes = vec![None; 128];

Review Comment:
   Yes. Type ids are `i8`s, and negative values should not be valid so we bound 
the total number of spaces to 128
   
   In terms of using a direct-indexed Vec by type id over a hashmap, I just 
chose not to overcomplicate things. Fwiw, I've yet to write benchmarks for this 
(I'll plan on doing that later on) and if this part shows up in a profile, I'll 
happily update it
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to