@@ -68,6 +68,9 @@ struct InvalidKernelOutput;
6868#[ derive( Clone ) ]
6969struct PackedPositive ;
7070
71+ #[ derive( Clone ) ]
72+ struct PackedGreaterThan ;
73+
7174#[ derive( Clone ) ]
7275struct ValidOnlyPositive ;
7376
@@ -344,6 +347,27 @@ impl RowFn for PackedPositive {
344347 }
345348}
346349
350+ impl RowFn for PackedGreaterThan {
351+ type Options = EmptyOptions ;
352+
353+ const ARG_NAMES : & ' static [ & ' static str ] = & [ "lhs" , "rhs" ] ;
354+ const INFALLIBLE : bool = true ;
355+
356+ fn id ( & self ) -> ScalarFnId {
357+ static ID : CachedId = CachedId :: new ( "test.packed_greater_than" ) ;
358+ * ID
359+ }
360+
361+ fn dispatch < V : RowVisitor > (
362+ & self ,
363+ _options : & Self :: Options ,
364+ _args : & [ DType ] ,
365+ visitor : V ,
366+ ) -> VortexResult < V :: VisitResult > {
367+ visitor. visit :: < ( i64 , i64 ) , bool > ( |( lhs, rhs) | lhs > rhs)
368+ }
369+ }
370+
347371impl RowFn for ValidOnlyPositive {
348372 type Options = EmptyOptions ;
349373
@@ -473,6 +497,39 @@ fn test_bool_output_word_boundaries(#[case] len: usize) -> VortexResult<()> {
473497 Ok ( ( ) )
474498}
475499
500+ #[ test]
501+ fn test_bool_output_handles_partial_constants ( ) -> VortexResult < ( ) > {
502+ let values: Vec < _ > = ( 0_i64 ..65 ) . collect ( ) ;
503+ let varying = PrimitiveArray :: from_iter ( values. iter ( ) . copied ( ) ) . into_array ( ) ;
504+ let constant = ConstantArray :: new ( 32_i64 , values. len ( ) ) . into_array ( ) ;
505+ let mut ctx = array_session ( ) . create_execution_ctx ( ) ;
506+
507+ let lhs_varying = VecExecutionArgs :: new ( vec ! [ varying. clone( ) , constant. clone( ) ] , values. len ( ) ) ;
508+ let actual = execute_rows ( & PackedGreaterThan , & EmptyOptions , & lhs_varying, & mut ctx) ?;
509+ let expected = BoolArray :: from_iter ( values. iter ( ) . map ( |value| * value > 32 ) ) . into_array ( ) ;
510+ assert_arrays_eq ! ( & actual, & expected, & mut ctx) ;
511+
512+ let rhs_varying = VecExecutionArgs :: new ( vec ! [ constant, varying] , values. len ( ) ) ;
513+ let actual = execute_rows ( & PackedGreaterThan , & EmptyOptions , & rhs_varying, & mut ctx) ?;
514+ let expected = BoolArray :: from_iter ( values. iter ( ) . map ( |value| 32 > * value) ) . into_array ( ) ;
515+ assert_arrays_eq ! ( & actual, & expected, & mut ctx) ;
516+
517+ Ok ( ( ) )
518+ }
519+
520+ #[ test]
521+ fn test_bool_output_handles_all_constant_input ( ) -> VortexResult < ( ) > {
522+ let input = ConstantArray :: new ( 7_i64 , 65 ) . into_array ( ) ;
523+ let args = VecExecutionArgs :: new ( vec ! [ input] , 65 ) ;
524+ let mut ctx = array_session ( ) . create_execution_ctx ( ) ;
525+
526+ let actual = execute_rows ( & PackedPositive , & EmptyOptions , & args, & mut ctx) ?;
527+ let expected = BoolArray :: from_iter ( std:: iter:: repeat_n ( true , 65 ) ) . into_array ( ) ;
528+
529+ assert_arrays_eq ! ( & actual, & expected, & mut ctx) ;
530+ Ok ( ( ) )
531+ }
532+
476533#[ test]
477534fn test_bool_output_handles_nullary_rows ( ) -> VortexResult < ( ) > {
478535 let args = VecExecutionArgs :: new ( vec ! [ ] , 65 ) ;
0 commit comments