@@ -2089,6 +2089,7 @@ where
2089
2089
compare_op ( left_array, right_array, op)
2090
2090
}
2091
2091
2092
+ #[ cfg( feature = "dyn_cmp_dict" ) ]
2092
2093
macro_rules! typed_dict_non_dict_cmp {
2093
2094
( $LEFT: expr, $RIGHT: expr, $LEFT_KEY_TYPE: expr, $RIGHT_TYPE: tt, $OP_BOOL: expr, $OP: expr) => { {
2094
2095
match $LEFT_KEY_TYPE {
@@ -2132,6 +2133,7 @@ macro_rules! typed_dict_non_dict_cmp {
2132
2133
} } ;
2133
2134
}
2134
2135
2136
+ #[ cfg( feature = "dyn_cmp_dict" ) ]
2135
2137
macro_rules! typed_cmp_dict_non_dict {
2136
2138
( $LEFT: expr, $RIGHT: expr, $OP_BOOL: expr, $OP: expr) => { {
2137
2139
match ( $LEFT. data_type( ) , $RIGHT. data_type( ) ) {
@@ -2182,6 +2184,16 @@ macro_rules! typed_cmp_dict_non_dict {
2182
2184
} } ;
2183
2185
}
2184
2186
2187
+ #[ cfg( not( feature = "dyn_cmp_dict" ) ) ]
2188
+ macro_rules! typed_cmp_dict_non_dict {
2189
+ ( $LEFT: expr, $RIGHT: expr, $OP_BOOL: expr, $OP: expr) => { {
2190
+ Err ( ArrowError :: CastError ( format!(
2191
+ "Comparing dictionary array of type {} with array of type {} requires \" dyn_cmp_dict\" feature" ,
2192
+ $LEFT. data_type( ) , $RIGHT. data_type( )
2193
+ ) ) )
2194
+ } }
2195
+ }
2196
+
2185
2197
macro_rules! typed_compares {
2186
2198
( $LEFT: expr, $RIGHT: expr, $OP_BOOL: expr, $OP: expr, $OP_FLOAT: expr) => { {
2187
2199
match ( $LEFT. data_type( ) , $RIGHT. data_type( ) ) {
@@ -2298,6 +2310,7 @@ macro_rules! typed_compares {
2298
2310
}
2299
2311
2300
2312
/// Applies $OP to $LEFT and $RIGHT which are two dictionaries which have (the same) key type $KT
2313
+ #[ cfg( feature = "dyn_cmp_dict" ) ]
2301
2314
macro_rules! typed_dict_cmp {
2302
2315
( $LEFT: expr, $RIGHT: expr, $OP: expr, $OP_FLOAT: expr, $OP_BOOL: expr, $KT: tt) => { {
2303
2316
match ( $LEFT. value_type( ) , $RIGHT. value_type( ) ) {
@@ -2430,6 +2443,7 @@ macro_rules! typed_dict_cmp {
2430
2443
} } ;
2431
2444
}
2432
2445
2446
+ #[ cfg( feature = "dyn_cmp_dict" ) ]
2433
2447
macro_rules! typed_dict_compares {
2434
2448
// Applies `LEFT OP RIGHT` when `LEFT` and `RIGHT` both are `DictionaryArray`
2435
2449
( $LEFT: expr, $RIGHT: expr, $OP: expr, $OP_FLOAT: expr, $OP_BOOL: expr) => { {
@@ -2494,8 +2508,19 @@ macro_rules! typed_dict_compares {
2494
2508
} } ;
2495
2509
}
2496
2510
2511
+ #[ cfg( not( feature = "dyn_cmp_dict" ) ) ]
2512
+ macro_rules! typed_dict_compares {
2513
+ ( $LEFT: expr, $RIGHT: expr, $OP: expr, $OP_FLOAT: expr, $OP_BOOL: expr) => { {
2514
+ Err ( ArrowError :: CastError ( format!(
2515
+ "Comparing array of type {} with array of type {} requires \" dyn_cmp_dict\" feature" ,
2516
+ $LEFT. data_type( ) , $RIGHT. data_type( )
2517
+ ) ) )
2518
+ } }
2519
+ }
2520
+
2497
2521
/// Perform given operation on `DictionaryArray` and `PrimitiveArray`. The value
2498
2522
/// type of `DictionaryArray` is same as `PrimitiveArray`'s type.
2523
+ #[ cfg( feature = "dyn_cmp_dict" ) ]
2499
2524
fn cmp_dict_primitive < K , T , F > (
2500
2525
left : & DictionaryArray < K > ,
2501
2526
right : & dyn Array ,
@@ -2516,6 +2541,7 @@ where
2516
2541
/// Perform given operation on two `DictionaryArray`s which value type is
2517
2542
/// primitive type. Returns an error if the two arrays have different value
2518
2543
/// type
2544
+ #[ cfg( feature = "dyn_cmp_dict" ) ]
2519
2545
pub fn cmp_dict < K , T , F > (
2520
2546
left : & DictionaryArray < K > ,
2521
2547
right : & DictionaryArray < K > ,
@@ -2535,6 +2561,7 @@ where
2535
2561
2536
2562
/// Perform the given operation on two `DictionaryArray`s which value type is
2537
2563
/// `DataType::Boolean`.
2564
+ #[ cfg( feature = "dyn_cmp_dict" ) ]
2538
2565
pub fn cmp_dict_bool < K , F > (
2539
2566
left : & DictionaryArray < K > ,
2540
2567
right : & DictionaryArray < K > ,
@@ -2553,6 +2580,7 @@ where
2553
2580
2554
2581
/// Perform the given operation on two `DictionaryArray`s which value type is
2555
2582
/// `DataType::Utf8` or `DataType::LargeUtf8`.
2583
+ #[ cfg( feature = "dyn_cmp_dict" ) ]
2556
2584
pub fn cmp_dict_utf8 < K , OffsetSize : OffsetSizeTrait , F > (
2557
2585
left : & DictionaryArray < K > ,
2558
2586
right : & DictionaryArray < K > ,
@@ -2574,6 +2602,7 @@ where
2574
2602
2575
2603
/// Perform the given operation on two `DictionaryArray`s which value type is
2576
2604
/// `DataType::Binary` or `DataType::LargeBinary`.
2605
+ #[ cfg( feature = "dyn_cmp_dict" ) ]
2577
2606
pub fn cmp_dict_binary < K , OffsetSize : OffsetSizeTrait , F > (
2578
2607
left : & DictionaryArray < K > ,
2579
2608
right : & DictionaryArray < K > ,
@@ -5476,6 +5505,7 @@ mod tests {
5476
5505
}
5477
5506
5478
5507
#[ test]
5508
+ #[ cfg( feature = "dyn_cmp_dict" ) ]
5479
5509
fn test_eq_dyn_neq_dyn_dictionary_i8_array ( ) {
5480
5510
// Construct a value array
5481
5511
let values = Int8Array :: from_iter_values ( [ 10_i8 , 11 , 12 , 13 , 14 , 15 , 16 , 17 ] ) ;
@@ -5496,6 +5526,7 @@ mod tests {
5496
5526
}
5497
5527
5498
5528
#[ test]
5529
+ #[ cfg( feature = "dyn_cmp_dict" ) ]
5499
5530
fn test_eq_dyn_neq_dyn_dictionary_u64_array ( ) {
5500
5531
let values = UInt64Array :: from_iter_values ( [ 10_u64 , 11 , 12 , 13 , 14 , 15 , 16 , 17 ] ) ;
5501
5532
@@ -5517,6 +5548,7 @@ mod tests {
5517
5548
}
5518
5549
5519
5550
#[ test]
5551
+ #[ cfg( feature = "dyn_cmp_dict" ) ]
5520
5552
fn test_eq_dyn_neq_dyn_dictionary_utf8_array ( ) {
5521
5553
let test1 = vec ! [ "a" , "a" , "b" , "c" ] ;
5522
5554
let test2 = vec ! [ "a" , "b" , "b" , "c" ] ;
@@ -5544,6 +5576,7 @@ mod tests {
5544
5576
}
5545
5577
5546
5578
#[ test]
5579
+ #[ cfg( feature = "dyn_cmp_dict" ) ]
5547
5580
fn test_eq_dyn_neq_dyn_dictionary_binary_array ( ) {
5548
5581
let values: BinaryArray = [ "hello" , "" , "parquet" ]
5549
5582
. into_iter ( )
@@ -5568,6 +5601,7 @@ mod tests {
5568
5601
}
5569
5602
5570
5603
#[ test]
5604
+ #[ cfg( feature = "dyn_cmp_dict" ) ]
5571
5605
fn test_eq_dyn_neq_dyn_dictionary_interval_array ( ) {
5572
5606
let values = IntervalDayTimeArray :: from ( vec ! [ 1 , 6 , 10 , 2 , 3 , 5 ] ) ;
5573
5607
@@ -5589,6 +5623,7 @@ mod tests {
5589
5623
}
5590
5624
5591
5625
#[ test]
5626
+ #[ cfg( feature = "dyn_cmp_dict" ) ]
5592
5627
fn test_eq_dyn_neq_dyn_dictionary_date_array ( ) {
5593
5628
let values = Date32Array :: from ( vec ! [ 1 , 6 , 10 , 2 , 3 , 5 ] ) ;
5594
5629
@@ -5610,6 +5645,7 @@ mod tests {
5610
5645
}
5611
5646
5612
5647
#[ test]
5648
+ #[ cfg( feature = "dyn_cmp_dict" ) ]
5613
5649
fn test_eq_dyn_neq_dyn_dictionary_bool_array ( ) {
5614
5650
let values = BooleanArray :: from ( vec ! [ true , false ] ) ;
5615
5651
@@ -5631,6 +5667,7 @@ mod tests {
5631
5667
}
5632
5668
5633
5669
#[ test]
5670
+ #[ cfg( feature = "dyn_cmp_dict" ) ]
5634
5671
fn test_lt_dyn_gt_dyn_dictionary_i8_array ( ) {
5635
5672
// Construct a value array
5636
5673
let values = Int8Array :: from_iter_values ( [ 10_i8 , 11 , 12 , 13 , 14 , 15 , 16 , 17 ] ) ;
@@ -5660,6 +5697,7 @@ mod tests {
5660
5697
}
5661
5698
5662
5699
#[ test]
5700
+ #[ cfg( feature = "dyn_cmp_dict" ) ]
5663
5701
fn test_lt_dyn_gt_dyn_dictionary_bool_array ( ) {
5664
5702
let values = BooleanArray :: from ( vec ! [ true , false ] ) ;
5665
5703
@@ -5702,6 +5740,7 @@ mod tests {
5702
5740
}
5703
5741
5704
5742
#[ test]
5743
+ #[ cfg( feature = "dyn_cmp_dict" ) ]
5705
5744
fn test_eq_dyn_neq_dyn_dictionary_i8_i8_array ( ) {
5706
5745
let values = Int8Array :: from_iter_values ( [ 10_i8 , 11 , 12 , 13 , 14 , 15 , 16 , 17 ] ) ;
5707
5746
let keys = Int8Array :: from_iter_values ( [ 2_i8 , 3 , 4 ] ) ;
@@ -5736,6 +5775,7 @@ mod tests {
5736
5775
}
5737
5776
5738
5777
#[ test]
5778
+ #[ cfg( feature = "dyn_cmp_dict" ) ]
5739
5779
fn test_lt_dyn_lt_eq_dyn_gt_dyn_gt_eq_dyn_dictionary_i8_i8_array ( ) {
5740
5780
let values = Int8Array :: from_iter_values ( [ 10_i8 , 11 , 12 , 13 , 14 , 15 , 16 , 17 ] ) ;
5741
5781
let keys = Int8Array :: from_iter_values ( [ 2_i8 , 3 , 4 ] ) ;
0 commit comments