@@ -28,23 +28,24 @@ use vortex_session::VortexSession;
2828use vortex_sparse:: Sparse ;
2929
3030use crate :: BtrBlocksCompressor ;
31- use crate :: CompressionSessionExt ;
31+ use crate :: CompressionSession ;
3232use crate :: DELTA_SCHEME ;
33- use crate :: tests:: no_editions_compressor;
33+ use crate :: tests:: compressor;
34+ use crate :: tests:: default_compressor;
3435static SESSION : LazyLock < VortexSession > = LazyLock :: new ( vortex_array:: array_session) ;
3536
3637/// The default schemes plus opt-in Delta.
3738fn with_delta ( ) -> BtrBlocksCompressor {
38- let session = vortex_array :: array_session ( ) ;
39- session . register_scheme ( & DELTA_SCHEME ) ;
40- no_editions_compressor ( & session )
39+ let mut registry = CompressionSession :: default ( ) ;
40+ registry . register ( & DELTA_SCHEME ) ;
41+ compressor ( & registry )
4142}
4243
4344#[ test]
4445fn test_constant_compressed ( ) -> VortexResult < ( ) > {
4546 let values: Vec < i32 > = iter:: repeat_n ( 42 , 100 ) . collect ( ) ;
4647 let array = PrimitiveArray :: new ( Buffer :: copy_from ( & values) , Validity :: NonNullable ) ;
47- let btr = no_editions_compressor ( & SESSION ) ;
48+ let btr = default_compressor ( ) ;
4849 let compressed = btr. compress ( & array. into_array ( ) , & mut SESSION . create_execution_ctx ( ) ) ?;
4950 assert ! ( compressed. is:: <Constant >( ) ) ;
5051 Ok ( ( ) )
@@ -54,7 +55,7 @@ fn test_constant_compressed() -> VortexResult<()> {
5455fn test_for_compressed ( ) -> VortexResult < ( ) > {
5556 let values: Vec < i32 > = ( 0 ..1000 ) . map ( |i| 1_000_000 + ( ( i * 37 ) % 100 ) ) . collect ( ) ;
5657 let array = PrimitiveArray :: new ( Buffer :: copy_from ( & values) , Validity :: NonNullable ) ;
57- let btr = no_editions_compressor ( & SESSION ) ;
58+ let btr = default_compressor ( ) ;
5859 let compressed = btr. compress ( & array. into_array ( ) , & mut SESSION . create_execution_ctx ( ) ) ?;
5960 assert ! ( compressed. is:: <FoR >( ) ) ;
6061 Ok ( ( ) )
@@ -64,7 +65,7 @@ fn test_for_compressed() -> VortexResult<()> {
6465fn test_bitpacking_compressed ( ) -> VortexResult < ( ) > {
6566 let values: Vec < u32 > = ( 0 ..1000 ) . map ( |i| i % 16 ) . collect ( ) ;
6667 let array = PrimitiveArray :: new ( Buffer :: copy_from ( & values) , Validity :: NonNullable ) ;
67- let btr = no_editions_compressor ( & SESSION ) ;
68+ let btr = default_compressor ( ) ;
6869 let compressed = btr. compress ( & array. into_array ( ) , & mut SESSION . create_execution_ctx ( ) ) ?;
6970 assert ! ( compressed. is:: <BitPacked >( ) ) ;
7071 assert_eq ! (
@@ -93,7 +94,7 @@ fn test_sparse_compressed() -> VortexResult<()> {
9394 }
9495 }
9596 let array = PrimitiveArray :: new ( Buffer :: copy_from ( & values) , Validity :: NonNullable ) ;
96- let btr = no_editions_compressor ( & SESSION ) ;
97+ let btr = default_compressor ( ) ;
9798 let compressed = btr. compress ( & array. into_array ( ) , & mut SESSION . create_execution_ctx ( ) ) ?;
9899 assert ! ( compressed. is:: <Sparse >( ) ) ;
99100 Ok ( ( ) )
@@ -117,7 +118,7 @@ fn test_dict_compressed() -> VortexResult<()> {
117118 }
118119
119120 let array = PrimitiveArray :: new ( Buffer :: copy_from ( & codes) , Validity :: NonNullable ) ;
120- let btr = no_editions_compressor ( & SESSION ) ;
121+ let btr = default_compressor ( ) ;
121122 let compressed = btr. compress ( & array. into_array ( ) , & mut SESSION . create_execution_ctx ( ) ) ?;
122123 assert ! ( compressed. is:: <Dict >( ) ) ;
123124 Ok ( ( ) )
@@ -130,7 +131,7 @@ fn test_runend_compressed() -> VortexResult<()> {
130131 values. extend ( iter:: repeat_n ( ( i32:: MAX - 50 ) . wrapping_add ( i) , 10 ) ) ;
131132 }
132133 let array = PrimitiveArray :: new ( Buffer :: copy_from ( & values) , Validity :: NonNullable ) ;
133- let btr = no_editions_compressor ( & SESSION ) ;
134+ let btr = default_compressor ( ) ;
134135 let compressed = btr. compress ( & array. into_array ( ) , & mut SESSION . create_execution_ctx ( ) ) ?;
135136 assert ! ( compressed. is:: <RunEnd >( ) ) ;
136137 Ok ( ( ) )
@@ -140,7 +141,7 @@ fn test_runend_compressed() -> VortexResult<()> {
140141fn test_sequence_compressed ( ) -> VortexResult < ( ) > {
141142 let values: Vec < i32 > = ( 0 ..1000 ) . map ( |i| i * 7 ) . collect ( ) ;
142143 let array = PrimitiveArray :: new ( Buffer :: copy_from ( & values) , Validity :: NonNullable ) ;
143- let btr = no_editions_compressor ( & SESSION ) ;
144+ let btr = default_compressor ( ) ;
144145 let compressed = btr. compress ( & array. into_array ( ) , & mut SESSION . create_execution_ctx ( ) ) ?;
145146 assert ! ( compressed. is:: <Sequence >( ) ) ;
146147 Ok ( ( ) )
@@ -157,7 +158,7 @@ fn test_rle_compressed() -> VortexResult<()> {
157158 values. extend ( iter:: repeat_n ( v, 10 ) ) ;
158159 }
159160 let array = PrimitiveArray :: new ( Buffer :: copy_from ( & values) , Validity :: NonNullable ) ;
160- let btr = no_editions_compressor ( & SESSION ) ;
161+ let btr = default_compressor ( ) ;
161162 let compressed = btr. compress ( & array. into_array ( ) , & mut SESSION . create_execution_ctx ( ) ) ?;
162163 eprintln ! ( "{}" , compressed. display_tree( ) ) ;
163164 assert ! ( compressed. is:: <RunEnd >( ) ) ;
0 commit comments