adriangb commented on code in PR #27324:
URL: https://github.com/apache/datafusion/pull/27324#discussion_r4542088693
##########
datafusion/physical-plan/src/joins/hash_join/partitioned_hash_eval.rs:
##########
@@ -430,9 +430,15 @@ impl HashTableLookupExpr {
let mut partition_ids = Vec::with_capacity(num_rows);
router.route(keys, maps.len(), &mut partition_ids)?;
- with_hashes(keys, self.random_state.random_state(), |hashes| {
+ // Only a hash map probes by hash. When every map is an array map, no
+ // probe reads the hashes, so the lookup skips hashing the keys.
+ let needs_hashes = maps.iter().flatten().any(|map| {
+ let map: &Map = map;
+ matches!(map, Map::HashMap(_))
Review Comment:
can we make this an exhaustive match?
##########
datafusion/physical-plan/src/joins/hash_join/partitioned_hash_eval.rs:
##########
@@ -442,13 +448,15 @@ impl HashTableLookupExpr {
}
let mut next = starts.clone();
let mut rows = vec![0u32; num_rows];
- let mut sorted_hashes = vec![0u64; num_rows];
- for (row, (&id, &hash)) in
partition_ids.iter().zip(hashes).enumerate() {
+ for (row, &id) in partition_ids.iter().enumerate() {
let slot = &mut next[id as usize];
rows[*slot] = row as u32;
- sorted_hashes[*slot] = hash;
*slot += 1;
}
+ let sorted_hashes: Vec<u64> = match hashes {
Review Comment:
Should this be an `Option<Vec<u64>>` instead of an empty vec?
--
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]