1717
1818//! Functionality used both on logical and physical plans
1919
20+ #[ cfg( not( feature = "force_hash_collisions" ) ) ]
2021use std:: sync:: Arc ;
2122
2223use ahash:: RandomState ;
2324use arrow:: array:: * ;
2425use arrow:: datatypes:: * ;
2526use arrow:: row:: Rows ;
27+ #[ cfg( not( feature = "force_hash_collisions" ) ) ]
2628use arrow:: { downcast_dictionary_array, downcast_primitive_array} ;
2729use arrow_buffer:: IntervalDayTime ;
2830use arrow_buffer:: IntervalMonthDayNano ;
2931
32+ #[ cfg( not( feature = "force_hash_collisions" ) ) ]
3033use crate :: cast:: {
3134 as_boolean_array, as_fixed_size_list_array, as_generic_binary_array,
3235 as_large_list_array, as_list_array, as_primitive_array, as_string_array,
3336 as_struct_array,
3437} ;
35- use crate :: error:: { Result , _internal_err} ;
38+ use crate :: error:: Result ;
39+ #[ cfg( not( feature = "force_hash_collisions" ) ) ]
40+ use crate :: error:: _internal_err;
3641
3742// Combines two hashes into one hash
3843#[ inline]
@@ -41,6 +46,7 @@ pub fn combine_hashes(l: u64, r: u64) -> u64 {
4146 hash. wrapping_mul ( 37 ) . wrapping_add ( r)
4247}
4348
49+ #[ cfg( not( feature = "force_hash_collisions" ) ) ]
4450fn hash_null ( random_state : & RandomState , hashes_buffer : & ' _ mut [ u64 ] , mul_col : bool ) {
4551 if mul_col {
4652 hashes_buffer. iter_mut ( ) . for_each ( |hash| {
@@ -90,6 +96,7 @@ hash_float_value!((half::f16, u16), (f32, u32), (f64, u64));
9096/// Builds hash values of PrimitiveArray and writes them into `hashes_buffer`
9197/// If `rehash==true` this combines the previous hash value in the buffer
9298/// with the new hash using `combine_hashes`
99+ #[ cfg( not( feature = "force_hash_collisions" ) ) ]
93100fn hash_array_primitive < T > (
94101 array : & PrimitiveArray < T > ,
95102 random_state : & RandomState ,
@@ -135,6 +142,7 @@ fn hash_array_primitive<T>(
135142/// Hashes one array into the `hashes_buffer`
136143/// If `rehash==true` this combines the previous hash value in the buffer
137144/// with the new hash using `combine_hashes`
145+ #[ cfg( not( feature = "force_hash_collisions" ) ) ]
138146fn hash_array < T > (
139147 array : T ,
140148 random_state : & RandomState ,
@@ -180,6 +188,7 @@ fn hash_array<T>(
180188}
181189
182190/// Hash the values in a dictionary array
191+ #[ cfg( not( feature = "force_hash_collisions" ) ) ]
183192fn hash_dictionary < K : ArrowDictionaryKeyType > (
184193 array : & DictionaryArray < K > ,
185194 random_state : & RandomState ,
@@ -210,6 +219,7 @@ fn hash_dictionary<K: ArrowDictionaryKeyType>(
210219 Ok ( ( ) )
211220}
212221
222+ #[ cfg( not( feature = "force_hash_collisions" ) ) ]
213223fn hash_struct_array (
214224 array : & StructArray ,
215225 random_state : & RandomState ,
@@ -236,6 +246,7 @@ fn hash_struct_array(
236246 Ok ( ( ) )
237247}
238248
249+ #[ cfg( not( feature = "force_hash_collisions" ) ) ]
239250fn hash_list_array < OffsetSize > (
240251 array : & GenericListArray < OffsetSize > ,
241252 random_state : & RandomState ,
@@ -269,6 +280,7 @@ where
269280 Ok ( ( ) )
270281}
271282
283+ #[ cfg( not( feature = "force_hash_collisions" ) ) ]
272284fn hash_fixed_list_array (
273285 array : & FixedSizeListArray ,
274286 random_state : & RandomState ,
@@ -450,7 +462,11 @@ pub fn create_row_hashes_v2<'a>(
450462
451463#[ cfg( test) ]
452464mod tests {
453- use arrow:: { array:: * , datatypes:: * } ;
465+ use std:: sync:: Arc ;
466+
467+ use arrow:: array:: * ;
468+ #[ cfg( not( feature = "force_hash_collisions" ) ) ]
469+ use arrow:: datatypes:: * ;
454470
455471 use super :: * ;
456472
0 commit comments