jonathanc-n commented on code in PR #20179:
URL: https://github.com/apache/datafusion/pull/20179#discussion_r2777805353
##########
datafusion/common/src/hash_utils.rs:
##########
@@ -481,23 +483,39 @@ fn hash_map_array(
let offsets = array.offsets();
// Create hashes for each entry in each row
- let mut values_hashes = vec![0u64; array.entries().len()];
- create_hashes(array.entries().columns(), random_state, &mut
values_hashes)?;
+ let first_offset = offsets.first().copied().unwrap_or_default() as usize;
+ let last_offset = offsets.last().copied().unwrap_or_default() as usize;
+ let entries_len = last_offset - first_offset;
+
+ // Only hash the entries that are actually referenced
+ let mut values_hashes = vec![0u64; entries_len];
+ let entries = array.entries();
+ let sliced_columns: Vec<ArrayRef> = entries
+ .columns()
+ .iter()
+ .map(|col| col.slice(first_offset, entries_len))
Review Comment:
I don't think so, its quite a cheap operation compared to the hashing
overhead.
--
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]