@@ -18,7 +18,6 @@ use crate::ArrayPlugin;
1818use crate :: ArrayRef ;
1919use crate :: IntoArray ;
2020use crate :: RecursiveCanonical ;
21- use crate :: TEST_SESSION ;
2221use crate :: VTable ;
2322use crate :: VortexSessionExecute ;
2423use crate :: aggregate_fn:: AggregateFnVTableExt ;
@@ -32,6 +31,7 @@ use crate::aggregate_fn::fns::min_max::MinMax;
3231use crate :: aggregate_fn:: fns:: min_max:: min_max;
3332use crate :: aggregate_fn:: fns:: sum:: Sum ;
3433use crate :: aggregate_fn:: session:: AggregateFnSessionExt ;
34+ use crate :: array_session;
3535use crate :: arrays:: BoolArray ;
3636use crate :: arrays:: ConstantArray ;
3737use crate :: arrays:: DictArray ;
@@ -92,7 +92,7 @@ fn rejects_wrong_logical_child_dtype() {
9292#[ case:: i128_to_i64( DecimalArray :: from_iter( [ i128 :: MAX ] , DecimalDType :: new( 10 , 0 ) ) ) ]
9393#[ case:: i256_to_i128( DecimalArray :: from_iter( [ i256:: from_parts( 0 , 1 ) ] , DecimalDType :: new( 38 , 0 ) ) ) ]
9494fn wider_native_input_cast_checks_overflow ( #[ case] array : DecimalArray ) {
95- let mut ctx = TEST_SESSION . create_execution_ctx ( ) ;
95+ let mut ctx = array_session ( ) . create_execution_ctx ( ) ;
9696 let err = array. materialize_values ( & mut ctx) . unwrap_err ( ) ;
9797 assert ! (
9898 err. to_string( ) . contains( "Integer does not fit" ) ,
@@ -102,7 +102,7 @@ fn wider_native_input_cast_checks_overflow(#[case] array: DecimalArray) {
102102
103103#[ test]
104104fn wider_native_input_materializes_at_logical_width ( ) -> VortexResult < ( ) > {
105- let mut ctx = TEST_SESSION . create_execution_ctx ( ) ;
105+ let mut ctx = array_session ( ) . create_execution_ctx ( ) ;
106106 let dtype = DecimalDType :: new ( 10 , 2 ) ;
107107 let array = DecimalArray :: from_iter ( [ 0i128 , 1 , -2 ] , dtype) . materialize_values ( & mut ctx) ?;
108108 assert_eq ! ( array. values_type( ) , DecimalType :: I64 ) ;
@@ -121,7 +121,7 @@ fn wider_native_input_materializes_at_logical_width() -> VortexResult<()> {
121121#[ case:: wide( DecimalArray :: from_iter( [ -1i128 , 1 ] , DecimalDType :: new( 38 , 0 ) ) ) ]
122122#[ case:: narrow_wide( DecimalArray :: from_option_iter( [ Some ( -1i128 ) , None ] , DecimalDType :: new( 76 , 0 ) ) ) ]
123123fn materialization_reuses_native_children ( #[ case] array : DecimalArray ) -> VortexResult < ( ) > {
124- let mut ctx = TEST_SESSION . create_execution_ctx ( ) ;
124+ let mut ctx = array_session ( ) . create_execution_ctx ( ) ;
125125 let materialized = array. materialize_values ( & mut ctx) ?;
126126 assert ! ( ArrayRef :: ptr_eq( array. as_ref( ) , materialized. as_ref( ) ) ) ;
127127
@@ -130,7 +130,7 @@ fn materialization_reuses_native_children(#[case] array: DecimalArray) -> Vortex
130130
131131#[ test]
132132fn canonicalization_preserves_encoded_child ( ) -> VortexResult < ( ) > {
133- let mut ctx = TEST_SESSION . create_execution_ctx ( ) ;
133+ let mut ctx = array_session ( ) . create_execution_ctx ( ) ;
134134 let dtype = DecimalDType :: new ( 76 , 2 ) ;
135135 let dictionary = DictArray :: try_new (
136136 buffer ! [ 0u8 , 1 , 0 , 1 ] . into_array ( ) ,
@@ -178,7 +178,7 @@ fn canonicalization_preserves_encoded_child() -> VortexResult<()> {
178178
179179#[ test]
180180fn wide_patch_widens_storage ( ) -> VortexResult < ( ) > {
181- let mut ctx = TEST_SESSION . create_execution_ctx ( ) ;
181+ let mut ctx = array_session ( ) . create_execution_ctx ( ) ;
182182 let dtype = DecimalDType :: new ( 39 , 0 ) ;
183183 let value = 1i128 << 100 ;
184184 let patches = Patches :: new (
@@ -207,7 +207,7 @@ fn wide_patch_widens_storage() -> VortexResult<()> {
207207#[ case:: nonnullable( Nullability :: NonNullable ) ]
208208#[ case:: nullable( Nullability :: Nullable ) ]
209209fn fill_null_accepts_a_wider_logical_value ( #[ case] nullability : Nullability ) -> VortexResult < ( ) > {
210- let mut ctx = TEST_SESSION . create_execution_ctx ( ) ;
210+ let mut ctx = array_session ( ) . create_execution_ctx ( ) ;
211211 let dtype = DecimalDType :: new ( 39 , 0 ) ;
212212 let value = 1i128 << 100 ;
213213 let array = DecimalArray :: from_option_iter ( [ Some ( 1i8 ) , None , Some ( -2 ) ] , dtype) ;
@@ -241,7 +241,7 @@ fn nonnullable_cast_checks_encoded_child_validity(
241241 #[ case] precision : u8 ,
242242 #[ values( true , false ) ] second_valid : bool ,
243243) -> VortexResult < ( ) > {
244- let mut ctx = TEST_SESSION . create_execution_ctx ( ) ;
244+ let mut ctx = array_session ( ) . create_execution_ctx ( ) ;
245245 let source = DecimalDType :: new ( 39 , 2 ) ;
246246 let target = DecimalDType :: new ( precision, 2 ) ;
247247 let dictionary = DictArray :: try_new (
@@ -282,7 +282,7 @@ fn precision_widening_cast_preserves_encoded_child(
282282 #[ case] precision : u8 ,
283283 #[ case] width : DecimalType ,
284284) -> VortexResult < ( ) > {
285- let mut ctx = TEST_SESSION . create_execution_ctx ( ) ;
285+ let mut ctx = array_session ( ) . create_execution_ctx ( ) ;
286286 let dictionary = DictArray :: try_new (
287287 buffer ! [ 0u8 , 1 , 0 ] . into_array ( ) ,
288288 buffer ! [ 1i32 , -2 ] . into_array ( ) ,
@@ -319,7 +319,7 @@ fn precision_widening_cast_preserves_encoded_child(
319319
320320#[ test]
321321fn aggregates_and_comparisons_keep_decimal_semantics ( ) -> VortexResult < ( ) > {
322- let mut ctx = TEST_SESSION . create_execution_ctx ( ) ;
322+ let mut ctx = array_session ( ) . create_execution_ctx ( ) ;
323323 let dtype = DecimalDType :: new ( 39 , 2 ) ;
324324 let array = DecimalArray :: from_iter ( [ -128i8 , -1 , 0 , 127 ] , dtype) . into_array ( ) ;
325325 let bounds = min_max ( & array, & mut ctx, NumericalAggregateOpts :: default ( ) ) ?
@@ -354,7 +354,7 @@ fn between_outside_storage_range_preserves_nulls(
354354 #[ case] lower : i128 ,
355355 #[ case] upper : i128 ,
356356) -> VortexResult < ( ) > {
357- let mut ctx = TEST_SESSION . create_execution_ctx ( ) ;
357+ let mut ctx = array_session ( ) . create_execution_ctx ( ) ;
358358 let dtype = DecimalDType :: new ( 39 , 0 ) ;
359359 let array = DecimalArray :: from_option_iter ( [ Some ( -1i8 ) , None , Some ( 1 ) ] , dtype) ;
360360 let bound = |value| {
@@ -384,7 +384,8 @@ fn between_outside_storage_range_preserves_nulls(
384384
385385#[ test]
386386fn partial_aggregates_preserve_decimal_boundaries ( ) -> VortexResult < ( ) > {
387- let mut ctx = TEST_SESSION . create_execution_ctx ( ) ;
387+ let session = array_session ( ) ;
388+ let mut ctx = session. create_execution_ctx ( ) ;
388389 let dtype = DecimalDType :: new ( 76 , 2 ) ;
389390 let input_dtype = DType :: Decimal ( dtype, Nullability :: Nullable ) ;
390391 for aggregate in [
@@ -393,7 +394,7 @@ fn partial_aggregates_preserve_decimal_boundaries() -> VortexResult<()> {
393394 IsConstant . bind ( EmptyOptions ) ,
394395 ] {
395396 assert ! (
396- TEST_SESSION
397+ session
397398 . aggregate_fns( )
398399 . find_aggregate_kernel( VTable :: id( & Decimal ) , aggregate. id( ) )
399400 . is_some( )
@@ -421,11 +422,12 @@ fn partial_aggregates_preserve_decimal_boundaries() -> VortexResult<()> {
421422
422423#[ test]
423424fn sum_uses_the_decimal_kernel ( ) -> VortexResult < ( ) > {
424- let mut ctx = TEST_SESSION . create_execution_ctx ( ) ;
425+ let session = array_session ( ) ;
426+ let mut ctx = session. create_execution_ctx ( ) ;
425427 let dtype = DecimalDType :: new ( 39 , 2 ) ;
426428 let array = DecimalArray :: from_iter ( [ 10i8 , 20 ] , dtype) . into_array ( ) ;
427429 let aggregate = Sum . bind ( NumericalAggregateOpts :: default ( ) ) ;
428- let kernel = TEST_SESSION
430+ let kernel = session
429431 . aggregate_fns ( )
430432 . find_aggregate_kernel ( VTable :: id ( & Decimal ) , aggregate. id ( ) )
431433 . vortex_expect ( "Decimal registers a fallback aggregate kernel" ) ;
@@ -447,7 +449,7 @@ fn sum_uses_the_decimal_kernel() -> VortexResult<()> {
447449
448450#[ test]
449451fn legacy_wire_keeps_narrow_storage ( ) -> VortexResult < ( ) > {
450- let session = & TEST_SESSION ;
452+ let session = & array_session ( ) ;
451453 let array =
452454 DecimalArray :: from_option_iter ( [ Some ( 10i32 ) , None , Some ( -20 ) ] , DecimalDType :: new ( 76 , 2 ) )
453455 . into_array ( ) ;
0 commit comments