Skip to content

Commit 705bb98

Browse files
committed
address comments
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
1 parent 2cd311b commit 705bb98

5 files changed

Lines changed: 18 additions & 11 deletions

File tree

encodings/fastlanes/src/bitpacking/plugin.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff 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()

encodings/parquet-variant/src/vtable.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff 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

encodings/zigzag/src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,12 @@ pub use vtable::*;
66

77
mod compress;
88
mod 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+
}

vortex-array/src/session/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
use std::sync::Arc;
55

66
use vortex_error::VortexResult;
7+
use vortex_error::vortex_bail;
78
use vortex_session::Ref;
89
use vortex_session::SessionExt;
910
use 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
}

vortex-file/src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,12 @@ pub use forever_constant::*;
110110
pub use open::*;
111111
pub use strategy::*;
112112
use vortex_array::arrays::Dict;
113-
use vortex_array::arrays::scalar_fn::plugin::ScalarFnArrayPlugin;
114113
use vortex_array::session::ArraySessionExt;
115114
use vortex_bytebool::ByteBool;
116115
use vortex_fsst::FSST;
117116
use vortex_pco::Pco;
118117
use vortex_session::VortexSession;
119118
use vortex_sparse::Sparse;
120-
use vortex_zigzag::ZigZag;
121119
pub 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);

0 commit comments

Comments
 (0)