Skip to content

Commit 08fdcd4

Browse files
committed
fix some tests
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
1 parent 48fd841 commit 08fdcd4

5 files changed

Lines changed: 22 additions & 29 deletions

File tree

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/pco/src/test.rs

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,

vortex-array/src/serde.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -694,8 +694,6 @@ impl TryFrom<BufferHandle> for SerializedArray {
694694

695695
#[cfg(test)]
696696
mod tests {
697-
use std::sync::LazyLock;
698-
699697
use flatbuffers::FlatBufferBuilder;
700698
use vortex_session::VortexSession;
701699
use vortex_session::registry::ReadContext;
@@ -710,8 +708,6 @@ mod tests {
710708
use crate::session::ArraySession;
711709
use crate::session::ArraySessionExt;
712710

713-
static SESSION: LazyLock<VortexSession> = LazyLock::new(VortexSession::empty);
714-
715711
#[test]
716712
fn unknown_array_encoding_allow_unknown() {
717713
let mut fbb = FlatBufferBuilder::new();
@@ -770,11 +766,11 @@ mod tests {
770766
"vortex.test.foreign_child"
771767
);
772768
assert_eq!(
773-
SESSION.array_serialize(&decoded).unwrap().unwrap(),
769+
session.array_serialize(&decoded).unwrap().unwrap(),
774770
vec![1, 2, 3]
775771
);
776772
assert_eq!(
777-
SESSION
773+
session
778774
.array_serialize(&decoded.nth_child(0).unwrap())
779775
.unwrap()
780776
.unwrap(),
@@ -784,7 +780,7 @@ mod tests {
784780
let serialized = decoded
785781
.serialize(
786782
&ArrayContext::default(),
787-
&SESSION,
783+
&session,
788784
&SerializeOptions::default(),
789785
)
790786
.unwrap();

vortex-array/src/session/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ use crate::arrays::Bool;
1515
use crate::arrays::Chunked;
1616
use crate::arrays::Constant;
1717
use crate::arrays::Decimal;
18+
use crate::arrays::Dict;
1819
use crate::arrays::Extension;
1920
use crate::arrays::FixedSizeList;
2021
use crate::arrays::List;
@@ -73,6 +74,7 @@ impl Default for ArraySession {
7374
// Register the utility encodings.
7475
this.register(Chunked);
7576
this.register(Constant);
77+
this.register(Dict);
7678
this.register(List);
7779
this.register(Masked);
7880
this.register(Patched);

vortex-layout/src/layouts/flat/writer.rs

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -468,27 +468,23 @@ mod tests {
468468
let ctx = ArrayContext::empty();
469469

470470
// Write the array into a byte buffer.
471-
let (layout, _segments) = {
472-
let segments = Arc::new(TestSegments::default());
473-
let (ptr, eof) = SequenceId::root().split();
474-
// Only allow the dict encoding; canonical primitive children remain permitted.
475-
let mut allowed = HashSet::default();
476-
allowed.insert(Dict.id());
477-
let layout = FlatLayoutStrategy::default()
478-
.with_allow_encodings(allowed)
479-
.write_stream(
480-
ctx,
481-
Arc::<TestSegments>::clone(&segments),
482-
dict.into_array().to_array_stream().sequenced(ptr),
483-
eof,
484-
&session,
485-
)
486-
.await;
487471

488-
(layout, segments)
489-
};
472+
let segments = Arc::new(TestSegments::default());
473+
let (ptr, eof) = SequenceId::root().split();
474+
// Only allow the dict encoding; canonical primitive children remain permitted.
475+
let mut allowed = HashSet::default();
476+
allowed.insert(Dict.id());
490477

491-
assert!(layout.is_ok());
478+
FlatLayoutStrategy::default()
479+
.with_allow_encodings(allowed)
480+
.write_stream(
481+
ctx,
482+
Arc::<TestSegments>::clone(&segments),
483+
dict.into_array().to_array_stream().sequenced(ptr),
484+
eof,
485+
&session,
486+
)
487+
.await?;
492488

493489
Ok(())
494490
})

0 commit comments

Comments
 (0)