File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -128,7 +128,7 @@ mod tests {
128128
129129 let array = bitpacked. as_array ( ) ;
130130
131- let metadata = SESSION . array_serialize ( array) ?. unwrap_or_default ( ) ;
131+ let metadata = SESSION . array_serialize ( array) ?. unwrap ( ) ;
132132 let children = array. children ( ) ;
133133 let buffers = array
134134 . buffers ( )
@@ -177,7 +177,7 @@ mod tests {
177177
178178 let array = bitpacked. as_array ( ) ;
179179
180- let metadata = SESSION . array_serialize ( array) ?. unwrap_or_default ( ) ;
180+ let metadata = SESSION . array_serialize ( array) ?. unwrap ( ) ;
181181 let children = array. children ( ) ;
182182 let buffers = array
183183 . buffers ( )
@@ -207,7 +207,7 @@ mod tests {
207207 fn primitive_array_returns_error ( ) -> VortexResult < ( ) > {
208208 let array = PrimitiveArray :: from_iter ( [ 1i32 , 2 , 3 ] ) . into_array ( ) ;
209209
210- let metadata = SESSION . array_serialize ( & array) ?. unwrap_or_default ( ) ;
210+ let metadata = SESSION . array_serialize ( & array) ?. unwrap ( ) ;
211211 let children = array. children ( ) ;
212212 let buffers = array
213213 . buffers ( )
Original file line number Diff line number Diff line change @@ -246,7 +246,6 @@ mod tests {
246246 use vortex_array:: IntoArray ;
247247 use vortex_array:: Precision ;
248248 use vortex_array:: arrays:: VarBinViewArray ;
249- use vortex_array:: arrays:: Variant ;
250249 use vortex_array:: arrays:: VariantArray ;
251250 use vortex_array:: dtype:: DType ;
252251 use vortex_array:: dtype:: Nullability ;
@@ -264,13 +263,13 @@ mod tests {
264263
265264 use crate :: ParquetVariant ;
266265 use crate :: array:: ParquetVariantArrayExt ;
266+
267267 fn roundtrip ( array : ArrayRef ) -> ArrayRef {
268268 let dtype = array. dtype ( ) . clone ( ) ;
269269 let len = array. len ( ) ;
270270
271271 let session = VortexSession :: empty ( ) . with :: < ArraySession > ( ) ;
272272 session. arrays ( ) . register ( ParquetVariant ) ;
273- session. arrays ( ) . register ( Variant ) ;
274273
275274 let ctx = ArrayContext :: empty ( ) ;
276275 let serialized = array
@@ -282,8 +281,6 @@ mod tests {
282281 concat. extend_from_slice ( buf. as_ref ( ) ) ;
283282 }
284283 let concat = concat. freeze ( ) ;
285- session. arrays ( ) . register ( ParquetVariant ) ;
286- session. arrays ( ) . register ( Variant ) ;
287284
288285 let parts = SerializedArray :: try_from ( concat) . unwrap ( ) ;
289286 parts
Original file line number Diff line number Diff line change @@ -6,3 +6,12 @@ pub use vtable::*;
66
77mod compress;
88mod vtable;
9+
10+ use vortex_array:: arrays:: scalar_fn:: plugin:: ScalarFnArrayPlugin ;
11+ use vortex_array:: session:: ArraySessionExt ;
12+ use vortex_session:: VortexSession ;
13+
14+ /// Initialize sequence encoding in the given session.
15+ pub fn initialize ( session : & VortexSession ) {
16+ session. arrays ( ) . register ( ScalarFnArrayPlugin :: new ( ZigZag ) ) ;
17+ }
Original file line number Diff line number Diff line change 44use std:: sync:: Arc ;
55
66use vortex_error:: VortexResult ;
7+ use vortex_error:: vortex_bail;
78use vortex_session:: Ref ;
89use vortex_session:: SessionExt ;
910use vortex_session:: registry:: Registry ;
@@ -96,8 +97,9 @@ pub trait ArraySessionExt: SessionExt {
9697 /// Serialize an array using a plugin from the registry.
9798 fn array_serialize ( & self , array : & ArrayRef ) -> VortexResult < Option < Vec < u8 > > > {
9899 let Some ( plugin) = self . arrays ( ) . registry . find ( & array. encoding_id ( ) ) else {
99- return Ok ( None ) ;
100+ vortex_bail ! ( "Array is not registered for serializations" ) ;
100101 } ;
102+
101103 plugin. serialize ( array, & self . session ( ) )
102104 }
103105}
Original file line number Diff line number Diff line change @@ -110,14 +110,12 @@ pub use forever_constant::*;
110110pub use open:: * ;
111111pub use strategy:: * ;
112112use vortex_array:: arrays:: Dict ;
113- use vortex_array:: arrays:: scalar_fn:: plugin:: ScalarFnArrayPlugin ;
114113use vortex_array:: session:: ArraySessionExt ;
115114use vortex_bytebool:: ByteBool ;
116115use vortex_fsst:: FSST ;
117116use vortex_pco:: Pco ;
118117use vortex_session:: VortexSession ;
119118use vortex_sparse:: Sparse ;
120- use vortex_zigzag:: ZigZag ;
121119pub use writer:: * ;
122120
123121/// The current version of the Vortex file format
@@ -164,7 +162,7 @@ pub fn register_default_encodings(session: &VortexSession) {
164162 arrays. register ( FSST ) ;
165163 arrays. register ( Pco ) ;
166164 arrays. register ( Sparse ) ;
167- arrays . register ( ScalarFnArrayPlugin :: new ( ZigZag ) ) ;
165+
168166 #[ cfg( feature = "zstd" ) ]
169167 arrays. register ( vortex_zstd:: Zstd ) ;
170168 #[ cfg( all( feature = "zstd" , feature = "unstable_encodings" ) ) ]
@@ -179,6 +177,7 @@ pub fn register_default_encodings(session: &VortexSession) {
179177 vortex_fastlanes:: initialize ( session) ;
180178 vortex_runend:: initialize ( session) ;
181179 vortex_sequence:: initialize ( session) ;
180+ vortex_zigzag:: initialize ( session) ;
182181
183182 #[ cfg( feature = "unstable_encodings" ) ]
184183 vortex_tensor:: initialize ( session) ;
You can’t perform that action at this time.
0 commit comments