Skip to content

Commit c897b28

Browse files
committed
remove metadata from DynArray
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
1 parent 8b587bb commit c897b28

15 files changed

Lines changed: 42 additions & 153 deletions

File tree

encodings/alp/src/alp/plugin.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ mod tests {
133133

134134
let array = alp_encoded.as_array();
135135

136-
let metadata = array.metadata(&SESSION)?.unwrap_or_default();
136+
let metadata = SESSION.array_serialize(array)?.unwrap();
137137
let children = array.children();
138138
let buffers = array
139139
.buffers()
@@ -182,7 +182,7 @@ mod tests {
182182

183183
let array = alp_encoded.as_array();
184184

185-
let metadata = array.metadata(&SESSION)?.unwrap_or_default();
185+
let metadata = SESSION.array_serialize(array)?.unwrap();
186186
let children = array.children();
187187
let buffers = array
188188
.buffers()
@@ -213,7 +213,7 @@ mod tests {
213213
fn primitive_array_returns_error() {
214214
let array = PrimitiveArray::from_iter([1.0f64, 2.0, 3.0]).into_array();
215215

216-
let metadata = array.metadata(&SESSION).unwrap().unwrap_or_default();
216+
let metadata = SESSION.array_serialize(&array).unwrap().unwrap();
217217
let children = array.children();
218218
let buffers = array
219219
.buffers()

encodings/bytebool/src/array.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,6 @@ impl From<Vec<Option<bool>>> for ByteBoolData {
352352
mod tests {
353353
use vortex_array::ArrayContext;
354354
use vortex_array::IntoArray;
355-
use vortex_array::LEGACY_SESSION;
356355
use vortex_array::assert_arrays_eq;
357356
use vortex_array::serde::SerializeOptions;
358357
use vortex_array::serde::SerializedArray;
@@ -407,7 +406,7 @@ mod tests {
407406
let serialized = array
408407
.clone()
409408
.into_array()
410-
.serialize(&ctx, &LEGACY_SESSION, &SerializeOptions::default())
409+
.serialize(&ctx, &session, &SerializeOptions::default())
411410
.unwrap();
412411

413412
let mut concat = ByteBufferMut::empty();

encodings/fastlanes/src/bitpacking/plugin.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ mod tests {
133133

134134
let array = bitpacked.as_array();
135135

136-
let metadata = array.metadata(&SESSION)?.unwrap_or_default();
136+
let metadata = SESSION.array_serialize(array)?.unwrap();
137137
let children = array.children();
138138
let buffers = array
139139
.buffers()
@@ -182,7 +182,7 @@ mod tests {
182182

183183
let array = bitpacked.as_array();
184184

185-
let metadata = array.metadata(&SESSION)?.unwrap_or_default();
185+
let metadata = SESSION.array_serialize(array)?.unwrap();
186186
let children = array.children();
187187
let buffers = array
188188
.buffers()
@@ -212,7 +212,7 @@ mod tests {
212212
fn primitive_array_returns_error() -> VortexResult<()> {
213213
let array = PrimitiveArray::from_iter([1i32, 2, 3]).into_array();
214214

215-
let metadata = array.metadata(&SESSION)?.unwrap_or_default();
215+
let metadata = SESSION.array_serialize(&array)?.unwrap();
216216
let children = array.children();
217217
let buffers = array
218218
.buffers()

encodings/parquet-variant/src/vtable.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,13 +244,13 @@ mod tests {
244244
use vortex_array::IntoArray;
245245
use vortex_array::Precision;
246246
use vortex_array::arrays::VarBinViewArray;
247-
use vortex_array::arrays::Variant;
248247
use vortex_array::arrays::VariantArray;
249248
use vortex_array::dtype::DType;
250249
use vortex_array::dtype::Nullability;
251250
use vortex_array::dtype::PType;
252251
use vortex_array::serde::SerializeOptions;
253252
use vortex_array::serde::SerializedArray;
253+
use vortex_array::session::ArraySession;
254254
use vortex_array::session::ArraySessionExt;
255255
use vortex_array::validity::Validity;
256256
use vortex_buffer::BitBuffer;
@@ -261,11 +261,14 @@ mod tests {
261261

262262
use crate::ParquetVariant;
263263
use crate::array::ParquetVariantArrayExt;
264+
264265
fn roundtrip(array: ArrayRef) -> ArrayRef {
265266
let dtype = array.dtype().clone();
266267
let len = array.len();
267268

268-
let session = VortexSession::empty().with::<vortex_array::session::ArraySession>();
269+
let session = VortexSession::empty().with::<ArraySession>();
270+
session.arrays().register(ParquetVariant);
271+
269272
let ctx = ArrayContext::empty();
270273
let serialized = array
271274
.serialize(&ctx, &session, &SerializeOptions::default())
@@ -276,8 +279,6 @@ mod tests {
276279
concat.extend_from_slice(buf.as_ref());
277280
}
278281
let concat = concat.freeze();
279-
session.arrays().register(ParquetVariant);
280-
session.arrays().register(Variant);
281282

282283
let parts = SerializedArray::try_from(concat).unwrap();
283284
parts

encodings/pco/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ mod array;
55
mod compute;
66
mod rules;
77
mod slice;
8-
#[cfg(test)]
9-
mod test;
108

119
pub use array::*;
1210

@@ -35,3 +33,6 @@ pub struct PcoMetadata {
3533
#[prost(message, repeated, tag = "2")]
3634
pub chunks: Vec<PcoChunkInfo>,
3735
}
36+
37+
#[cfg(test)]
38+
mod tests;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ fn test_serde() -> VortexResult<()> {
184184
let bytes = pco
185185
.serialize(
186186
&context,
187-
&LEGACY_SESSION,
187+
&SESSION,
188188
&SerializeOptions {
189189
offset: 0,
190190
include_padding: true,

encodings/runend/src/arrow.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ mod tests {
9090
use vortex_array::search_sorted::SearchSorted;
9191
use vortex_array::search_sorted::SearchSortedSide;
9292
use vortex_array::session::ArraySession;
93+
use vortex_array::session::ArraySessionExt;
9394
use vortex_array::validity::Validity;
9495
use vortex_buffer::Buffer;
9596
use vortex_buffer::buffer;
@@ -99,8 +100,11 @@ mod tests {
99100
use crate::RunEnd;
100101
use crate::ops::find_slice_end_index;
101102

102-
static SESSION: LazyLock<VortexSession> =
103-
LazyLock::new(|| VortexSession::empty().with::<ArraySession>());
103+
static SESSION: LazyLock<VortexSession> = LazyLock::new(|| {
104+
let session = VortexSession::empty().with::<ArraySession>();
105+
session.arrays().register(RunEnd);
106+
session
107+
});
104108

105109
fn decode_run_array<R: RunEndIndexType>(
106110
array: &RunArray<R>,

encodings/zstd/src/zstd_buffers.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ impl ZstdBuffers {
5959
session: &VortexSession,
6060
) -> VortexResult<ZstdBuffersArray> {
6161
let encoding_id = array.encoding_id();
62-
let metadata = array
63-
.metadata(session)?
64-
.ok_or_else(|| vortex_err!("Array does not support serialization"))?;
62+
let metadata = session
63+
.array_serialize(array)?
64+
.ok_or_else(|| vortex_err!("[ZstdBuffers]: Array does not support serialization"))?;
6565
let buffer_handles = array.buffer_handles();
6666
let children = array.children();
6767

vortex-array/public-api.lock

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22024,8 +22024,6 @@ pub fn vortex_array::ArrayRef::is_valid(&self, index: usize) -> vortex_error::Vo
2202422024

2202522025
pub fn vortex_array::ArrayRef::len(&self) -> usize
2202622026

22027-
pub fn vortex_array::ArrayRef::metadata(&self, session: &vortex_session::VortexSession) -> vortex_error::VortexResult<core::option::Option<alloc::vec::Vec<u8>>>
22028-
2202922027
pub fn vortex_array::ArrayRef::metadata_fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result
2203022028

2203122029
pub fn vortex_array::ArrayRef::named_buffers(&self) -> alloc::vec::Vec<(alloc::string::String, vortex_array::buffer::BufferHandle)>

vortex-array/src/array/erased.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ use vortex_error::vortex_ensure;
1515
use vortex_error::vortex_err;
1616
use vortex_error::vortex_panic;
1717
use vortex_mask::Mask;
18-
use vortex_session::VortexSession;
1918

2019
use crate::AnyCanonical;
2120
use crate::Array;
@@ -561,11 +560,6 @@ impl ArrayRef {
561560
self.0.slot_name(self, idx)
562561
}
563562

564-
/// Returns the serialized metadata of the array.
565-
pub fn metadata(&self, session: &VortexSession) -> VortexResult<Option<Vec<u8>>> {
566-
self.0.metadata(self, session)
567-
}
568-
569563
/// Formats a human-readable metadata description.
570564
pub fn metadata_fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
571565
self.0.metadata_fmt(f)

0 commit comments

Comments
 (0)