@@ -223,7 +223,8 @@ fn interleave_dictionaries<K: ArrowDictionaryKeyType>(
223
223
// to concatenating values
224
224
_ if !is_overflow => interleave_fallback( arrays, indices) ,
225
225
other => Err ( ArrowError :: NotYetImplemented ( format!(
226
- "interleave of dictionaries would overflow key type {key_type:?} with value type {other:?}" ,
226
+ "interleave of dictionaries would overflow key type {key_type:?} and \
227
+ value type {other:?} not yet supported for merging",
227
228
key_type = K :: DATA_TYPE ,
228
229
) ) )
229
230
}
@@ -547,6 +548,33 @@ mod tests {
547
548
assert_eq ! ( & collected, & [ 0 , 0 , 1 ] ) ;
548
549
}
549
550
551
+ #[ test]
552
+ fn test_unsupported_interleave_dictionary_overflow ( ) {
553
+ // each array has length equal to the full dictionary key space
554
+ let len: usize = usize:: try_from ( i8:: MAX ) . unwrap ( ) ;
555
+
556
+ let a = DictionaryArray :: < Int8Type > :: new (
557
+ Int8Array :: from_value ( 0 , len) ,
558
+ Arc :: new ( NullArray :: new ( len) ) ,
559
+ ) ;
560
+ let b = DictionaryArray :: < Int8Type > :: new (
561
+ Int8Array :: from_value ( 0 , len) ,
562
+ Arc :: new ( NullArray :: new ( len) ) ,
563
+ ) ;
564
+
565
+ // Case 1: with a single input array, should _never_ overflow
566
+ interleave ( & [ & a] , & [ ( 0 , 2 ) , ( 0 , 2 ) ] ) . unwrap ( ) ;
567
+
568
+ // Case 2: two arrays
569
+ // Will fail to merge values on unsupported datatype
570
+ let values = interleave ( & [ & a, & b] , & [ ( 0 , 2 ) , ( 0 , 2 ) , ( 1 , 1 ) ] ) . unwrap_err ( ) ;
571
+ assert_eq ! (
572
+ values. to_string( ) ,
573
+ "Not yet implemented: qinterleave of dictionaries would overflow key type Int8 and \
574
+ value type Null not yet supported for merging"
575
+ ) ;
576
+ }
577
+
550
578
#[ test]
551
579
fn test_lists ( ) {
552
580
// [[1, 2], null, [3]]
0 commit comments