File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -322,7 +322,7 @@ fn hash_fixed_list_array(
322322) -> Result < ( ) > {
323323 let values = Arc :: clone ( array. values ( ) ) ;
324324 let value_len = array. value_length ( ) ;
325- let offset_size = value_len as usize / array. len ( ) ;
325+ let offset_size = if array . len ( ) == 0 { 0 } else { value_len as usize / array. len ( ) } ;
326326 let nulls = array. nulls ( ) ;
327327 let mut values_hashes = vec ! [ 0u64 ; values. len( ) ] ;
328328 create_hashes ( & [ values] , random_state, & mut values_hashes) ?;
@@ -454,6 +454,20 @@ mod tests {
454454 Ok ( ( ) )
455455 }
456456
457+ #[ test]
458+ fn create_hashes_for_empty_fixed_size_lit ( ) -> Result < ( ) > {
459+ let empty_array = FixedSizeListBuilder :: new ( StringBuilder :: new ( ) , 1 ) . finish ( ) ;
460+ let random_state = RandomState :: with_seeds ( 0 , 0 , 0 , 0 ) ;
461+ let hashes_buff = & mut vec ! [ 0 ; 0 ] ;
462+ let hashes = create_hashes (
463+ & [ Arc :: new ( empty_array) ] ,
464+ & random_state,
465+ hashes_buff,
466+ ) ?;
467+ assert_eq ! ( hashes, & Vec :: <u64 >:: new( ) ) ;
468+ Ok ( ( ) )
469+ }
470+
457471 #[ test]
458472 fn create_hashes_for_float_arrays ( ) -> Result < ( ) > {
459473 let f32_arr = Arc :: new ( Float32Array :: from ( vec ! [ 0.12 , 0.5 , 1f32 , 444.7 ] ) ) ;
You can’t perform that action at this time.
0 commit comments