jayzhan211 commented on code in PR #8552:
URL: https://github.com/apache/arrow-datafusion/pull/8552#discussion_r1430131304


##########
datafusion/common/src/hash_utils.rs:
##########
@@ -207,6 +208,36 @@ fn hash_dictionary<K: ArrowDictionaryKeyType>(
     Ok(())
 }
 
+fn hash_struct_array(
+    array: &StructArray,
+    random_state: &RandomState,
+    hashes_buffer: &mut [u64],
+) -> Result<()> {
+    let values = array.columns();
+    let nulls = array.nulls();
+    let num_columns = values.len();
+
+    // Skip null columns
+    let valid_indices: Vec<usize> = if let Some(nulls) = nulls {
+        nulls.valid_indices().collect()
+    } else {
+        (0..num_columns).collect()
+    };
+
+    for i in valid_indices {
+        let mut values_hashes = vec![0u64; array.len()];
+        let column_values = values[i].clone();
+        // create hashes for each column
+        create_hashes(&[column_values], random_state, &mut values_hashes)?;
+        let hash = &mut hashes_buffer[i];

Review Comment:
   I think I mistake how the null buffer works in StructArray. It seems to be 
row-wise, but I consider it as column-wise...



-- 
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]

Reply via email to