alamb commented on a change in pull request #9595:
URL: https://github.com/apache/arrow/pull/9595#discussion_r586420039
##########
File path: rust/datafusion/src/physical_plan/hash_join.rs
##########
@@ -699,13 +726,11 @@ macro_rules! hash_array {
}
/// Creates hash values for every element in the row based on the values in
the columns
-pub fn create_hashes(
+pub fn create_hashes<'a>(
arrays: &[ArrayRef],
random_state: &RandomState,
-) -> Result<Vec<u64>> {
- let rows = arrays[0].len();
- let mut hashes = vec![0; rows];
-
+ hashes: &'a mut Vec<u64>,
Review comment:
I think it would help readability to name this `hashes_buffer ` for
consistency
##########
File path: rust/datafusion/src/physical_plan/hash_join.rs
##########
@@ -311,6 +319,7 @@ fn update_hash(
hash: &mut JoinHashMap,
offset: usize,
random_state: &RandomState,
+ hashes_buffer: &mut Vec<u64>,
Review comment:
This is effectively allowing `hashes_buffer ` to be reused, right?
It may eventually make sense to make some struct that holds all the relevant
state (`on`, `random_state`, `hash_buf`, etc).
##########
File path: rust/datafusion/src/physical_plan/hash_join.rs
##########
@@ -476,15 +485,16 @@ fn build_join_indexes(
.into_array(left_data.1.num_rows()))
})
.collect::<Result<Vec<_>>>()?;
-
- let hash_values = create_hashes(&keys_values, &random_state)?;
+ let hash_buff = &mut vec![0; keys_values[0].len()];
Review comment:
I recommend naming this `hashes_buffer` for consistency with its use
elsewhere
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]