korowa commented on code in PR #11806:
URL: https://github.com/apache/datafusion/pull/11806#discussion_r1703600132


##########
datafusion/physical-plan/src/joins/hash_join.rs:
##########
@@ -1964,12 +1960,21 @@ mod tests {
 
         assert_eq!(columns, vec!["a1", "b2", "c1", "a1", "b2", "c2"]);
 
-        // expected joined records = 3
-        // in case batch_size is 1 - additional empty batch for remaining 3-2 
row
-        let mut expected_batch_count = div_ceil(3, batch_size);
-        if batch_size == 1 {
-            expected_batch_count += 1;
-        }
+        let expected_batch_count = if cfg!(not(feature = 
"force_hash_collisions")) {
+            // Expected number of hash table matches = 3
+            // in case batch_size is 1 - additional empty batch for remaining 
3-2 row
+            let mut expected_batch_count = div_ceil(3, batch_size);
+            if batch_size == 1 {
+                expected_batch_count += 1;
+            }
+            expected_batch_count
+        } else {
+            // With hash collisions enabled, all records will match each other
+            // and filtered later.
+            // Expected number of matches = 9
+            div_ceil(9, batch_size)

Review Comment:
   Yes, since 
[create_hashes](https://github.com/apache/datafusion/blob/1d3bdbe14fd01bbd03abeb57d3ec9bc155a36d71/datafusion/common/src/hash_utils.rs#L355)
 always sets 0 as hash values, with force-collisions feature enabled, the total 
number of hash table matches will be equal to `left.row_count() * 
right.row_count()` for each batch size. The result of the output batch count 
calculation depends on the batch size though, and it's based on the number of 
matches.



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

Reply via email to