ozankabak commented on code in PR #7366:
URL: https://github.com/apache/arrow-datafusion/pull/7366#discussion_r1301647039


##########
datafusion/core/src/physical_plan/joins/hash_join.rs:
##########
@@ -781,22 +780,33 @@ pub fn build_equal_condition_join_indices(
     //     (5,1)
     //
     // With this approach, the lexicographic order on both the probe side and 
the build side is preserved.
+    let hash_map = build_hashmap.get_map();
+    let next_chain = build_hashmap.get_list();
     for (row, hash_value) in hash_values.iter().enumerate().rev() {
         // Get the hash and find it in the build index
 
         // For every item on the build and probe we check if it matches
         // This possibly contains rows with hash collisions,
         // So we have to check here whether rows are equal or not
-        if let Some((_, index)) = build_hashmap
-            .map
-            .get(*hash_value, |(hash, _)| *hash_value == *hash)
+        if let Some((_, index)) =
+            hash_map.get(*hash_value, |(hash, _)| *hash_value == *hash)
         {
             let mut i = *index - 1;
             loop {
-                build_indices.append(i);
+                let build_row_value = if let Some(offset) = deleted_offset {

Review Comment:
   The compiler should be able to hoist the check above the for loop, so the 
check should essentially be done only once in practice and not cause any perf 
issues. @metesynnada will verify this, but if it turns out the compiler can not 
do this automatically, we can do the hoisting manually (and unfortunately 
duplicate ~10 line the for loop code).



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to