@@ -1583,7 +1583,6 @@ mod tests {
1583
1583
use rstest:: * ;
1584
1584
use rstest_reuse:: * ;
1585
1585
1586
- #[ cfg( not( feature = "force_hash_collisions" ) ) ]
1587
1586
fn div_ceil ( a : usize , b : usize ) -> usize {
1588
1587
( a + b - 1 ) / b
1589
1588
}
@@ -1931,9 +1930,6 @@ mod tests {
1931
1930
Ok ( ( ) )
1932
1931
}
1933
1932
1934
- // FIXME(#TODO) test fails with feature `force_hash_collisions`
1935
- // https://github.com/apache/datafusion/issues/11658
1936
- #[ cfg( not( feature = "force_hash_collisions" ) ) ]
1937
1933
#[ apply( batch_sizes) ]
1938
1934
#[ tokio:: test]
1939
1935
async fn join_inner_two ( batch_size : usize ) -> Result < ( ) > {
@@ -1964,12 +1960,20 @@ mod tests {
1964
1960
1965
1961
assert_eq ! ( columns, vec![ "a1" , "b2" , "c1" , "a1" , "b2" , "c2" ] ) ;
1966
1962
1967
- // expected joined records = 3
1968
- // in case batch_size is 1 - additional empty batch for remaining 3-2 row
1969
- let mut expected_batch_count = div_ceil ( 3 , batch_size) ;
1970
- if batch_size == 1 {
1971
- expected_batch_count += 1 ;
1972
- }
1963
+ let expected_batch_count = if cfg ! ( not( feature = "force_hash_collisions" ) ) {
1964
+ // Expected number of hash table matches = 3
1965
+ // in case batch_size is 1 - additional empty batch for remaining 3-2 row
1966
+ let mut expected_batch_count = div_ceil ( 3 , batch_size) ;
1967
+ if batch_size == 1 {
1968
+ expected_batch_count += 1 ;
1969
+ }
1970
+ expected_batch_count
1971
+ } else {
1972
+ // With hash collisions enabled, all records will match each other
1973
+ // and filtered later.
1974
+ div_ceil ( 9 , batch_size)
1975
+ } ;
1976
+
1973
1977
assert_eq ! ( batches. len( ) , expected_batch_count) ;
1974
1978
1975
1979
let expected = [
@@ -1989,9 +1993,6 @@ mod tests {
1989
1993
}
1990
1994
1991
1995
/// Test where the left has 2 parts, the right with 1 part => 1 part
1992
- // FIXME(#TODO) test fails with feature `force_hash_collisions`
1993
- // https://github.com/apache/datafusion/issues/11658
1994
- #[ cfg( not( feature = "force_hash_collisions" ) ) ]
1995
1996
#[ apply( batch_sizes) ]
1996
1997
#[ tokio:: test]
1997
1998
async fn join_inner_one_two_parts_left ( batch_size : usize ) -> Result < ( ) > {
@@ -2029,12 +2030,20 @@ mod tests {
2029
2030
2030
2031
assert_eq ! ( columns, vec![ "a1" , "b2" , "c1" , "a1" , "b2" , "c2" ] ) ;
2031
2032
2032
- // expected joined records = 3
2033
- // in case batch_size is 1 - additional empty batch for remaining 3-2 row
2034
- let mut expected_batch_count = div_ceil ( 3 , batch_size) ;
2035
- if batch_size == 1 {
2036
- expected_batch_count += 1 ;
2037
- }
2033
+ let expected_batch_count = if cfg ! ( not( feature = "force_hash_collisions" ) ) {
2034
+ // Expected number of hash table matches = 3
2035
+ // in case batch_size is 1 - additional empty batch for remaining 3-2 row
2036
+ let mut expected_batch_count = div_ceil ( 3 , batch_size) ;
2037
+ if batch_size == 1 {
2038
+ expected_batch_count += 1 ;
2039
+ }
2040
+ expected_batch_count
2041
+ } else {
2042
+ // With hash collisions enabled, all records will match each other
2043
+ // and filtered later.
2044
+ div_ceil ( 9 , batch_size)
2045
+ } ;
2046
+
2038
2047
assert_eq ! ( batches. len( ) , expected_batch_count) ;
2039
2048
2040
2049
let expected = [
@@ -2104,9 +2113,6 @@ mod tests {
2104
2113
}
2105
2114
2106
2115
/// Test where the left has 1 part, the right has 2 parts => 2 parts
2107
- // FIXME(#TODO) test fails with feature `force_hash_collisions`
2108
- // https://github.com/apache/datafusion/issues/11658
2109
- #[ cfg( not( feature = "force_hash_collisions" ) ) ]
2110
2116
#[ apply( batch_sizes) ]
2111
2117
#[ tokio:: test]
2112
2118
async fn join_inner_one_two_parts_right ( batch_size : usize ) -> Result < ( ) > {
@@ -2143,12 +2149,19 @@ mod tests {
2143
2149
let stream = join. execute ( 0 , Arc :: clone ( & task_ctx) ) ?;
2144
2150
let batches = common:: collect ( stream) . await ?;
2145
2151
2146
- // expected joined records = 1 (first right batch)
2147
- // and additional empty batch for non-joined 20-6-80
2148
- let mut expected_batch_count = div_ceil ( 1 , batch_size) ;
2149
- if batch_size == 1 {
2150
- expected_batch_count += 1 ;
2151
- }
2152
+ let expected_batch_count = if cfg ! ( not( feature = "force_hash_collisions" ) ) {
2153
+ // Expected number of hash table matches for first right batch = 1
2154
+ // and additional empty batch for non-joined 20-6-80
2155
+ let mut expected_batch_count = div_ceil ( 1 , batch_size) ;
2156
+ if batch_size == 1 {
2157
+ expected_batch_count += 1 ;
2158
+ }
2159
+ expected_batch_count
2160
+ } else {
2161
+ // With hash collisions enabled, all records will match each other
2162
+ // and filtered later.
2163
+ div_ceil ( 6 , batch_size)
2164
+ } ;
2152
2165
assert_eq ! ( batches. len( ) , expected_batch_count) ;
2153
2166
2154
2167
let expected = [
@@ -2166,8 +2179,14 @@ mod tests {
2166
2179
let stream = join. execute ( 1 , Arc :: clone ( & task_ctx) ) ?;
2167
2180
let batches = common:: collect ( stream) . await ?;
2168
2181
2169
- // expected joined records = 2 (second right batch)
2170
- let expected_batch_count = div_ceil ( 2 , batch_size) ;
2182
+ let expected_batch_count = if cfg ! ( not( feature = "force_hash_collisions" ) ) {
2183
+ // Expected number of hash table matches for second right batch = 2
2184
+ div_ceil ( 2 , batch_size)
2185
+ } else {
2186
+ // With hash collisions enabled, all records will match each other
2187
+ // and filtered later.
2188
+ div_ceil ( 3 , batch_size)
2189
+ } ;
2171
2190
assert_eq ! ( batches. len( ) , expected_batch_count) ;
2172
2191
2173
2192
let expected = [
@@ -3732,9 +3751,9 @@ mod tests {
3732
3751
| JoinType :: Right
3733
3752
| JoinType :: RightSemi
3734
3753
| JoinType :: RightAnti => {
3735
- ( expected_resultset_records + batch_size - 1 ) / batch_size
3754
+ div_ceil ( expected_resultset_records, batch_size)
3736
3755
}
3737
- _ => ( expected_resultset_records + batch_size - 1 ) / batch_size + 1 ,
3756
+ _ => div_ceil ( expected_resultset_records, batch_size) + 1 ,
3738
3757
} ;
3739
3758
assert_eq ! (
3740
3759
batches. len( ) ,
0 commit comments