@@ -27,7 +27,7 @@ impl BetweenKernel for Decimal {
2727 lower : & ArrayRef ,
2828 upper : & ArrayRef ,
2929 options : & BetweenOptions ,
30- _ctx : & mut ExecutionCtx ,
30+ ctx : & mut ExecutionCtx ,
3131 ) -> VortexResult < Option < ArrayRef > > {
3232 // NOTE: We know that the precision and scale were already checked to be equal by the main
3333 // `between` entrypoint function.
@@ -41,7 +41,7 @@ impl BetweenKernel for Decimal {
4141 arr. dtype ( ) . nullability ( ) | lower. dtype ( ) . nullability ( ) | upper. dtype ( ) . nullability ( ) ;
4242
4343 match_each_decimal_value_type ! ( arr. values_type( ) , |D | {
44- between_unpack:: <D >( arr, lower, upper, nullability, options)
44+ between_unpack:: <D >( arr, lower, upper, nullability, options, ctx )
4545 } )
4646 }
4747}
@@ -52,6 +52,7 @@ fn between_unpack<T: NativeDecimalType>(
5252 upper : Scalar ,
5353 nullability : Nullability ,
5454 options : & BetweenOptions ,
55+ ctx : & mut ExecutionCtx ,
5556) -> VortexResult < Option < ArrayRef > > {
5657 let Some ( lower_dv) = lower. as_decimal ( ) . decimal_value ( ) else {
5758 // Null lower bound — fall back to canonical path.
@@ -119,6 +120,7 @@ fn between_unpack<T: NativeDecimalType>(
119120 nullability,
120121 lower_op,
121122 upper_op,
123+ ctx,
122124 ) ) )
123125}
124126
@@ -129,15 +131,20 @@ fn between_impl<T: NativeDecimalType>(
129131 nullability : Nullability ,
130132 lower_op : impl Fn ( T , T ) -> bool ,
131133 upper_op : impl Fn ( T , T ) -> bool ,
134+ ctx : & mut ExecutionCtx ,
132135) -> ArrayRef {
133136 let buffer = arr. buffer :: < T > ( ) ;
134137 BoolArray :: new (
135- BitBuffer :: collect_bool_multiversioned ( buffer. len ( ) , |idx| {
136- // SAFETY: `collect_bool_multiversioned` invokes the predicate with indices
137- // `0..buffer.len()` only.
138- let value = unsafe { * buffer. get_unchecked ( idx) } ;
139- lower. is_none_or ( |l| lower_op ( l, value) ) & upper. is_none_or ( |u| upper_op ( value, u) )
140- } ) ,
138+ BitBuffer :: collect_bool_multiversioned_in (
139+ buffer. len ( ) ,
140+ |idx| {
141+ // SAFETY: `collect_bool_multiversioned` invokes the predicate with indices
142+ // `0..buffer.len()` only.
143+ let value = unsafe { * buffer. get_unchecked ( idx) } ;
144+ lower. is_none_or ( |l| lower_op ( l, value) ) & upper. is_none_or ( |u| upper_op ( value, u) )
145+ } ,
146+ ctx. allocator ( ) . clone ( ) ,
147+ ) ,
141148 arr. validity ( )
142149 . vortex_expect ( "validity should be derivable" )
143150 . union_nullability ( nullability) ,
0 commit comments