@@ -24,6 +24,9 @@ use arrow::compute::kernels::arithmetic::{
2424} ;
2525use arrow:: compute:: kernels:: boolean:: { and_kleene, not, or_kleene} ;
2626use arrow:: compute:: kernels:: comparison:: { eq, gt, gt_eq, lt, lt_eq, neq} ;
27+ use arrow:: compute:: kernels:: comparison:: {
28+ eq_bool, eq_bool_scalar, neq_bool, neq_bool_scalar,
29+ } ;
2730use arrow:: compute:: kernels:: comparison:: {
2831 eq_scalar, gt_eq_scalar, gt_scalar, lt_eq_scalar, lt_scalar, neq_scalar,
2932} ;
@@ -351,11 +354,8 @@ macro_rules! boolean_op_scalar {
351354 . downcast_ref:: <BooleanArray >( )
352355 . expect( "boolean_op_scalar failed to downcast array" ) ;
353356
354- let result = if let ScalarValue :: Boolean ( scalar) = $RIGHT {
355- Ok (
356- Arc :: new( paste:: expr! { [ <$OP _bool_scalar>] } ( & ll, scalar. as_ref( ) ) ?)
357- as ArrayRef ,
358- )
357+ let result = if let ScalarValue :: Boolean ( Some ( scalar) ) = $RIGHT {
358+ Ok ( Arc :: new( paste:: expr! { [ <$OP _bool_scalar>] } ( & ll, scalar) ?) as ArrayRef )
359359 } else {
360360 Err ( DataFusionError :: Internal ( format!(
361361 "boolean_op_scalar failed to cast literal value {}" ,
@@ -871,60 +871,6 @@ pub fn binary(
871871 Ok ( Arc :: new ( BinaryExpr :: new ( l, op, r) ) )
872872}
873873
874- // TODO file a ticket with arrow-rs to include these kernels
875-
876- fn eq_bool ( lhs : & BooleanArray , rhs : & BooleanArray ) -> Result < BooleanArray > {
877- let arr: BooleanArray = lhs
878- . iter ( )
879- . zip ( rhs. iter ( ) )
880- . map ( |v| match v {
881- // both lhs and rhs were non null
882- ( Some ( lhs) , Some ( rhs) ) => Some ( lhs == rhs) ,
883- _ => None ,
884- } )
885- . collect ( ) ;
886-
887- Ok ( arr)
888- }
889-
890- fn eq_bool_scalar ( lhs : & BooleanArray , rhs : Option < & bool > ) -> Result < BooleanArray > {
891- let arr: BooleanArray = lhs
892- . iter ( )
893- . map ( |v| match ( v, rhs) {
894- // both lhs and rhs were non null
895- ( Some ( lhs) , Some ( rhs) ) => Some ( lhs == * rhs) ,
896- _ => None ,
897- } )
898- . collect ( ) ;
899- Ok ( arr)
900- }
901-
902- fn neq_bool ( lhs : & BooleanArray , rhs : & BooleanArray ) -> Result < BooleanArray > {
903- let arr: BooleanArray = lhs
904- . iter ( )
905- . zip ( rhs. iter ( ) )
906- . map ( |v| match v {
907- // both lhs and rhs were non null
908- ( Some ( lhs) , Some ( rhs) ) => Some ( lhs != rhs) ,
909- _ => None ,
910- } )
911- . collect ( ) ;
912-
913- Ok ( arr)
914- }
915-
916- fn neq_bool_scalar ( lhs : & BooleanArray , rhs : Option < & bool > ) -> Result < BooleanArray > {
917- let arr: BooleanArray = lhs
918- . iter ( )
919- . map ( |v| match ( v, rhs) {
920- // both lhs and rhs were non null
921- ( Some ( lhs) , Some ( rhs) ) => Some ( lhs != * rhs) ,
922- _ => None ,
923- } )
924- . collect ( ) ;
925- Ok ( arr)
926- }
927-
928874#[ cfg( test) ]
929875mod tests {
930876 use arrow:: datatypes:: { ArrowNumericType , Field , Int32Type , SchemaRef } ;
0 commit comments