@@ -355,33 +355,7 @@ impl<T: ArrayValue> Array<T> {
355355 } ) ) ?
356356 }
357357
358- if self . shape [ 1 ..] != other. shape [ 1 ..] {
359- // Fill
360- match ctx. scalar_fill :: < T > ( ) {
361- Ok ( fill) => {
362- if map_keys. is_some ( ) {
363- return Err ( ctx. error ( format ! (
364- "Cannot {} {} map arrays" ,
365- Primitive :: Fill ,
366- Primitive :: Join
367- ) ) ) ;
368- }
369- let new_row_shape = max_shape ( & self . shape [ 1 ..] , & other. shape [ 1 ..] ) ;
370- for ( array, fill) in [ ( & mut self , fill. clone ( ) ) , ( & mut other, fill) ]
371- {
372- let mut new_shape = new_row_shape. clone ( ) ;
373- new_shape. prepend ( array. shape [ 0 ] ) ;
374- array. fill_to_shape ( & new_shape, fill) ;
375- }
376- }
377- Err ( e) => {
378- return Err ( C :: fill_error ( ctx. error ( format ! (
379- "Cannot join arrays of shapes {} and {}. {e}" ,
380- self . shape, other. shape
381- ) ) ) ) ;
382- }
383- }
384- } else {
358+ if self . shape [ 1 ..] == other. shape [ 1 ..] {
385359 // Set sorted flags
386360 match ( self . row_count ( ) , other. row_count ( ) ) {
387361 ( 0 , 0 ) => {
@@ -412,6 +386,32 @@ impl<T: ArrayValue> Array<T> {
412386 }
413387 }
414388 }
389+ } else {
390+ // Fill
391+ match ctx. scalar_fill :: < T > ( ) {
392+ Ok ( fill) => {
393+ if map_keys. is_some ( ) {
394+ return Err ( ctx. error ( format ! (
395+ "Cannot {} {} map arrays" ,
396+ Primitive :: Fill ,
397+ Primitive :: Join
398+ ) ) ) ;
399+ }
400+ let new_row_shape = max_shape ( & self . shape [ 1 ..] , & other. shape [ 1 ..] ) ;
401+ for ( array, fill) in [ ( & mut self , fill. clone ( ) ) , ( & mut other, fill) ]
402+ {
403+ let mut new_shape = new_row_shape. clone ( ) ;
404+ new_shape. prepend ( array. shape [ 0 ] ) ;
405+ array. fill_to_shape ( & new_shape, fill) ;
406+ }
407+ }
408+ Err ( e) => {
409+ return Err ( C :: fill_error ( ctx. error ( format ! (
410+ "Cannot join arrays of shapes {} and {}. {e}" ,
411+ self . shape, other. shape
412+ ) ) ) ) ;
413+ }
414+ }
415415 }
416416
417417 if self . data . len ( ) >= other. data . len ( ) {
@@ -1046,9 +1046,8 @@ impl Value {
10461046 }
10471047 }
10481048 row_values = values. into_iter ( ) ;
1049- let arr = match row_values. next ( ) . unwrap ( ) {
1050- Value :: Num ( arr) => arr,
1051- _ => unreachable ! ( ) ,
1049+ let Value :: Num ( arr) = row_values. next ( ) . unwrap ( ) else {
1050+ unreachable ! ( )
10521051 } ;
10531052 if let Some ( box_rank) = box_rank {
10541053 Value :: Box ( arr. box_depth ( box_rank) )
@@ -1074,9 +1073,8 @@ impl Value {
10741073 }
10751074 }
10761075 row_values = values. into_iter ( ) ;
1077- let arr = match row_values. next ( ) . unwrap ( ) {
1078- Value :: Byte ( arr) => arr,
1079- _ => unreachable ! ( ) ,
1076+ let Value :: Byte ( arr) = row_values. next ( ) . unwrap ( ) else {
1077+ unreachable ! ( )
10801078 } ;
10811079 if let Some ( box_rank) = box_rank {
10821080 Value :: Box ( arr. box_depth ( box_rank) )
@@ -1100,9 +1098,8 @@ impl Value {
11001098 }
11011099 }
11021100 row_values = values. into_iter ( ) ;
1103- let arr = match row_values. next ( ) . unwrap ( ) {
1104- Value :: Complex ( arr) => arr,
1105- _ => unreachable ! ( ) ,
1101+ let Value :: Complex ( arr) = row_values. next ( ) . unwrap ( ) else {
1102+ unreachable ! ( )
11061103 } ;
11071104 if let Some ( box_rank) = box_rank {
11081105 Value :: Box ( arr. box_depth ( box_rank) )
@@ -1125,9 +1122,8 @@ impl Value {
11251122 }
11261123 }
11271124 row_values = values. into_iter ( ) ;
1128- let arr = match row_values. next ( ) . unwrap ( ) {
1129- Value :: Char ( arr) => arr,
1130- _ => unreachable ! ( ) ,
1125+ let Value :: Char ( arr) = row_values. next ( ) . unwrap ( ) else {
1126+ unreachable ! ( )
11311127 } ;
11321128 if let Some ( box_rank) = box_rank {
11331129 Value :: Box ( arr. box_depth ( box_rank) )
0 commit comments