@@ -337,18 +337,24 @@ pub fn gt_binary_scalar<OffsetSize: OffsetSizeTrait>(
337
337
}
338
338
339
339
/// Perform `left >= right` operation on [`BinaryArray`] / [`LargeBinaryArray`].
340
- pub fn gt_eq_binary < OffsetSize : OffsetSizeTrait > (
341
- left : & GenericBinaryArray < OffsetSize > ,
342
- right : & GenericBinaryArray < OffsetSize > ,
343
- ) -> Result < BooleanArray , ArrowError > {
340
+ pub fn gt_eq_bytes < T : ByteArrayType > (
341
+ left : & GenericByteArray < T > ,
342
+ right : & GenericByteArray < T > ,
343
+ ) -> Result < BooleanArray , ArrowError >
344
+ where
345
+ <T as ByteArrayType >:: Native : PartialOrd ,
346
+ {
344
347
compare_op ( left, right, |a, b| a >= b)
345
348
}
346
349
347
350
/// Perform `left >= right` operation on [`BinaryArray`] / [`LargeBinaryArray`] and a scalar.
348
- pub fn gt_eq_binary_scalar < OffsetSize : OffsetSizeTrait > (
349
- left : & GenericBinaryArray < OffsetSize > ,
350
- right : & [ u8 ] ,
351
- ) -> Result < BooleanArray , ArrowError > {
351
+ pub fn gt_eq_bytes_scalar < T : ByteArrayType > (
352
+ left : & GenericByteArray < T > ,
353
+ right : & <T as ByteArrayType >:: Native ,
354
+ ) -> Result < BooleanArray , ArrowError >
355
+ where
356
+ <T as ByteArrayType >:: Native : PartialOrd ,
357
+ {
352
358
compare_op_scalar ( left, |a| a >= right)
353
359
}
354
360
@@ -419,22 +425,6 @@ pub fn gt_utf8_scalar<OffsetSize: OffsetSizeTrait>(
419
425
compare_op_scalar ( left, |a| a > right)
420
426
}
421
427
422
- /// Perform `left >= right` operation on [`StringArray`] / [`LargeStringArray`].
423
- pub fn gt_eq_utf8 < OffsetSize : OffsetSizeTrait > (
424
- left : & GenericStringArray < OffsetSize > ,
425
- right : & GenericStringArray < OffsetSize > ,
426
- ) -> Result < BooleanArray , ArrowError > {
427
- compare_op ( left, right, |a, b| a >= b)
428
- }
429
-
430
- /// Perform `left >= right` operation on [`StringArray`] / [`LargeStringArray`] and a scalar.
431
- pub fn gt_eq_utf8_scalar < OffsetSize : OffsetSizeTrait > (
432
- left : & GenericStringArray < OffsetSize > ,
433
- right : & str ,
434
- ) -> Result < BooleanArray , ArrowError > {
435
- compare_op_scalar ( left, |a| a >= right)
436
- }
437
-
438
428
// Avoids creating a closure for each combination of `$RIGHT` and `$TY`
439
429
fn try_to_type_result < T > (
440
430
value : Option < T > ,
@@ -917,8 +907,8 @@ pub fn gt_eq_dyn_binary_scalar(
917
907
right : & [ u8 ] ,
918
908
) -> Result < BooleanArray , ArrowError > {
919
909
match left. data_type ( ) {
920
- DataType :: Binary => gt_eq_binary_scalar ( left. as_binary :: < i32 > ( ) , right) ,
921
- DataType :: LargeBinary => gt_eq_binary_scalar ( left. as_binary :: < i64 > ( ) , right) ,
910
+ DataType :: Binary => gt_eq_bytes_scalar ( left. as_binary :: < i32 > ( ) , right) ,
911
+ DataType :: LargeBinary => gt_eq_bytes_scalar ( left. as_binary :: < i64 > ( ) , right) ,
922
912
_ => Err ( ArrowError :: ComputeError (
923
913
"gt_eq_dyn_binary_scalar only supports Binary or LargeBinary arrays"
924
914
. to_string ( ) ,
@@ -991,17 +981,17 @@ pub fn gt_eq_dyn_utf8_scalar(
991
981
let result = match left. data_type ( ) {
992
982
DataType :: Dictionary ( key_type, value_type) => match value_type. as_ref ( ) {
993
983
DataType :: Utf8 | DataType :: LargeUtf8 => {
994
- dyn_compare_utf8_scalar ! ( left, right, key_type, gt_eq_utf8_scalar )
984
+ dyn_compare_utf8_scalar ! ( left, right, key_type, gt_eq_bytes_scalar )
995
985
}
996
986
_ => Err ( ArrowError :: ComputeError (
997
987
"gt_eq_dyn_utf8_scalar only supports Utf8 or LargeUtf8 arrays or DictionaryArray with Utf8 or LargeUtf8 values" . to_string ( ) ,
998
988
) ) ,
999
989
} ,
1000
990
DataType :: Utf8 => {
1001
- gt_eq_utf8_scalar ( left. as_string :: < i32 > ( ) , right)
991
+ gt_eq_bytes_scalar ( left. as_string :: < i32 > ( ) , right)
1002
992
}
1003
993
DataType :: LargeUtf8 => {
1004
- gt_eq_utf8_scalar ( left. as_string :: < i64 > ( ) , right)
994
+ gt_eq_bytes_scalar ( left. as_string :: < i64 > ( ) , right)
1005
995
}
1006
996
_ => Err ( ArrowError :: ComputeError (
1007
997
"gt_eq_dyn_utf8_scalar only supports Utf8 or LargeUtf8 arrays" . to_string ( ) ,
@@ -3656,14 +3646,14 @@ mod tests {
3656
3646
test_binary_array_gt_eq,
3657
3647
vec![ b"arrow" , b"datafusion" , b"flight" , b"parquet" , & [ 0xff , 0xf8 ] ] ,
3658
3648
vec![ b"flight" , b"flight" , b"flight" , b"flight" , & [ 0xff , 0xf8 ] ] ,
3659
- gt_eq_binary ,
3649
+ gt_eq_bytes ,
3660
3650
vec![ false , false , true , true , true ]
3661
3651
) ;
3662
3652
test_binary_scalar ! (
3663
3653
test_binary_array_gt_eq_scalar,
3664
3654
vec![ b"arrow" , b"datafusion" , b"flight" , b"parquet" , & [ 0xff , 0xf8 ] ] ,
3665
3655
"flight" . as_bytes( ) ,
3666
- gt_eq_binary_scalar ,
3656
+ gt_eq_bytes_scalar ,
3667
3657
vec![ false , false , true , true , true ]
3668
3658
) ;
3669
3659
@@ -3879,14 +3869,14 @@ mod tests {
3879
3869
test_utf8_array_gt_eq,
3880
3870
vec![ "arrow" , "datafusion" , "flight" , "parquet" ] ,
3881
3871
vec![ "flight" , "flight" , "flight" , "flight" ] ,
3882
- gt_eq_utf8 ,
3872
+ gt_eq_bytes ,
3883
3873
vec![ false , false , true , true ]
3884
3874
) ;
3885
3875
test_utf8_scalar ! (
3886
3876
test_utf8_array_gt_eq_scalar,
3887
3877
vec![ "arrow" , "datafusion" , "flight" , "parquet" ] ,
3888
3878
"flight" ,
3889
- gt_eq_utf8_scalar ,
3879
+ gt_eq_bytes_scalar ,
3890
3880
vec![ false , false , true , true ]
3891
3881
) ;
3892
3882
0 commit comments