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_map_array, as_primitive_array,
3336 as_string_array, 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 ,
@@ -270,6 +280,7 @@ fn hash_map_array(
270280 Ok ( ( ) )
271281}
272282
283+ #[ cfg( not( feature = "force_hash_collisions" ) ) ]
273284fn hash_list_array < OffsetSize > (
274285 array : & GenericListArray < OffsetSize > ,
275286 random_state : & RandomState ,
@@ -303,6 +314,7 @@ where
303314 Ok ( ( ) )
304315}
305316
317+ #[ cfg( not( feature = "force_hash_collisions" ) ) ]
306318fn hash_fixed_list_array (
307319 array : & FixedSizeListArray ,
308320 random_state : & RandomState ,
@@ -488,7 +500,11 @@ pub fn create_row_hashes_v2<'a>(
488500
489501#[ cfg( test) ]
490502mod tests {
491- use arrow:: { array:: * , datatypes:: * } ;
503+ use std:: sync:: Arc ;
504+
505+ use arrow:: array:: * ;
506+ #[ cfg( not( feature = "force_hash_collisions" ) ) ]
507+ use arrow:: datatypes:: * ;
492508
493509 use super :: * ;
494510
0 commit comments