Skip to content

Commit 9c03cc1

Browse files
committed
Fix list layout checks after rebase
Signed-off-by: "Matt Katz" <mhkatz97@gmail.com> Signed-off-by: Matt Katz <mhkatz97@gmail.com>
1 parent 82a7e10 commit 9c03cc1

3 files changed

Lines changed: 25 additions & 5 deletions

File tree

vortex-layout/src/layouts/list/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use vortex_error::vortex_ensure_eq;
2020
use vortex_error::vortex_err;
2121
use vortex_error::vortex_panic;
2222
use vortex_session::VortexSession;
23+
use vortex_session::registry::CachedId;
2324

2425
use crate::LayoutBuildContext;
2526
use crate::LayoutChildType;
@@ -52,7 +53,8 @@ impl VTable for List {
5253
type Metadata = ProstMetadata<ListLayoutMetadata>;
5354

5455
fn id(_encoding: &Self::Encoding) -> LayoutId {
55-
LayoutId::new("vortex.list")
56+
static ID: CachedId = CachedId::new("vortex.list");
57+
*ID
5658
}
5759

5860
fn encoding(_layout: &Self::Layout) -> LayoutEncodingRef {

vortex-layout/src/layouts/list/reader.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,7 @@ mod tests {
692692
use vortex_array::expr::list_length;
693693
use vortex_array::expr::lit;
694694
use vortex_buffer::buffer;
695+
use vortex_io::session::RuntimeSession;
695696
use vortex_io::session::RuntimeSessionExt;
696697

697698
use super::*;
@@ -702,6 +703,7 @@ mod tests {
702703
use crate::segments::TestSegments;
703704
use crate::sequence::SequenceId;
704705
use crate::sequence::SequentialArrayStreamExt;
706+
use crate::session::LayoutSession;
705707
use crate::test::SESSION;
706708

707709
/// Validity-class projections (`is_null` / `is_not_null` of the list) round-trip through the
@@ -894,11 +896,17 @@ mod tests {
894896
ListLayoutStrategy::default()
895897
}
896898

899+
fn layout_test_session() -> VortexSession {
900+
vortex_array::array_session()
901+
.with::<LayoutSession>()
902+
.with::<RuntimeSession>()
903+
}
904+
897905
async fn write_layout<S: LayoutStrategy>(
898906
strategy: &S,
899907
array: ArrayRef,
900908
) -> VortexResult<(Arc<dyn SegmentSource>, LayoutRef, VortexSession)> {
901-
let session = SESSION.clone().with_tokio();
909+
let session = layout_test_session().with_tokio();
902910
let segments = Arc::new(TestSegments::default());
903911
let segments_ref: Arc<dyn SegmentSource> = Arc::<TestSegments>::clone(&segments);
904912
let (ptr, eof) = SequenceId::root().split();

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,25 +248,34 @@ mod tests {
248248
use vortex_array::dtype::PType;
249249
use vortex_array::validity::Validity;
250250
use vortex_buffer::buffer;
251+
use vortex_io::session::RuntimeSession;
251252

252253
use super::*;
253254
use crate::layouts::chunked::writer::ChunkedLayoutStrategy;
254255
use crate::layouts::flat::writer::FlatLayoutStrategy;
255256
use crate::layouts::table::TableStrategy;
256257
use crate::segments::TestSegments;
257258
use crate::sequence::SequentialArrayStreamExt;
258-
use crate::test::SESSION;
259+
use crate::session::LayoutSession;
260+
261+
fn layout_test_session() -> VortexSession {
262+
vortex_array::array_session()
263+
.with::<LayoutSession>()
264+
.with::<RuntimeSession>()
265+
.with_tokio()
266+
}
259267

260268
fn flat_list_strategy() -> ListLayoutStrategy {
261269
ListLayoutStrategy::default()
262270
}
263271

264272
async fn write<S: LayoutStrategy>(strategy: &S, array: ArrayRef) -> VortexResult<LayoutRef> {
273+
let session = layout_test_session();
265274
let segments = Arc::new(TestSegments::default());
266275
let (ptr, eof) = SequenceId::root().split();
267276
let stream = array.to_array_stream().sequenced(ptr);
268277
strategy
269-
.write_stream(ArrayContext::empty(), segments, stream, eof, &SESSION)
278+
.write_stream(ArrayContext::empty(), segments, stream, eof, &session)
270279
.await
271280
}
272281

@@ -339,9 +348,10 @@ mod tests {
339348
let (_, eof) = SequenceId::root().split();
340349
let empty = stream::empty::<VortexResult<(SequenceId, ArrayRef)>>().boxed();
341350
let stream = SequentialStreamAdapter::new(i32_list_dtype(false), empty).sendable();
351+
let session = layout_test_session();
342352

343353
let res = flat_list_strategy()
344-
.write_stream(ArrayContext::empty(), segments, stream, eof, &SESSION)
354+
.write_stream(ArrayContext::empty(), segments, stream, eof, &session)
345355
.await;
346356
assert!(res.is_err())
347357
}

0 commit comments

Comments
 (0)