Skip to content

Commit f8bc1e3

Browse files
committed
merge
Signed-off-by: Nicholas Gates <nick@nickgates.com>
1 parent 100f783 commit f8bc1e3

10 files changed

Lines changed: 167 additions & 135 deletions

File tree

vortex-array/src/arrays/struct_/array.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// SPDX-FileCopyrightText: Copyright the Vortex contributors
33

4-
use std::fmt::Debug;
54
use std::iter::once;
65
use std::sync::Arc;
76

vortex-array/src/arrays/variant/vtable/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ impl VTable for Variant {
9090
}
9191

9292
fn serialize(
93-
array: ArrayView<'_, Self>,
94-
session: &VortexSession,
93+
_array: ArrayView<'_, Self>,
94+
_session: &VortexSession,
9595
) -> VortexResult<Option<Vec<u8>>> {
9696
Ok(Some(vec![]))
9797
}

vortex-array/src/arrow/executor/run_end.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ use crate::IntoArray;
2424
use crate::arrays::Constant;
2525
use crate::arrays::ConstantArray;
2626
use crate::arrow::ArrowArrayExecutor;
27-
use crate::session::ArraySessionExt;
2827

2928
/// The encoding ID used by `vortex-runend`. We match on this string to avoid a crate dependency.
3029
const VORTEX_RUNEND_ID: &str = "vortex.runend";

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

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -364,23 +364,26 @@ mod test {
364364
let segments = Arc::new(TestSegments::default());
365365
let strategy = ChunkedLayoutStrategy::new(FlatLayoutStrategy::default());
366366
let (mut sequence_id, eof) = SequenceId::root().split();
367-
let layout = block_on(|handle| {
367+
let segments2 = Arc::<TestSegments>::clone(&segments);
368+
let layout = block_on(|handle| async move {
368369
let session = SESSION.clone().with_handle(handle);
369-
strategy.write_stream(
370-
ctx,
371-
Arc::<TestSegments>::clone(&segments),
372-
SequentialStreamAdapter::new(
373-
DType::Primitive(PType::I32, NonNullable),
374-
stream::iter([
375-
Ok((sequence_id.advance(), buffer![1, 2, 3].into_array())),
376-
Ok((sequence_id.advance(), buffer![4, 5, 6].into_array())),
377-
Ok((sequence_id.advance(), buffer![7, 8, 9].into_array())),
378-
]),
370+
strategy
371+
.write_stream(
372+
ctx,
373+
segments2,
374+
SequentialStreamAdapter::new(
375+
DType::Primitive(PType::I32, NonNullable),
376+
stream::iter([
377+
Ok((sequence_id.advance(), buffer![1, 2, 3].into_array())),
378+
Ok((sequence_id.advance(), buffer![4, 5, 6].into_array())),
379+
Ok((sequence_id.advance(), buffer![7, 8, 9].into_array())),
380+
]),
381+
)
382+
.sendable(),
383+
eof,
384+
&session,
379385
)
380-
.sendable(),
381-
eof,
382-
&session,
383-
)
386+
.await
384387
})
385388
.unwrap();
386389

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

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -275,10 +275,15 @@ mod tests {
275275
use vortex_array::expr::not;
276276
use vortex_array::expr::pack;
277277
use vortex_array::expr::root;
278+
use vortex_array::scalar_fn::session::ScalarFnSession;
279+
use vortex_array::session::ArraySession;
278280
use vortex_array::validity::Validity;
279281
use vortex_error::VortexExpect;
282+
use vortex_io::runtime::Handle;
280283
use vortex_io::runtime::single::block_on;
284+
use vortex_io::session::RuntimeSession;
281285
use vortex_io::session::RuntimeSessionExt;
286+
use vortex_session::VortexSession;
282287

283288
use crate::LayoutId;
284289
use crate::LayoutRef;
@@ -291,12 +296,23 @@ mod tests {
291296
use crate::sequence::SequentialArrayStreamExt;
292297
use crate::sequence::SequentialStreamAdapter;
293298
use crate::sequence::SequentialStreamExt;
294-
use crate::test::SESSION;
299+
use crate::session::LayoutSession;
300+
301+
// FIXME(ngates): Deprecate the global `runtime::single::block_on` helper and require tests
302+
// to call `block_on` on an explicit runtime instance.
303+
fn session_with_handle(handle: Handle) -> VortexSession {
304+
VortexSession::empty()
305+
.with::<ArraySession>()
306+
.with::<LayoutSession>()
307+
.with::<ScalarFnSession>()
308+
.with::<RuntimeSession>()
309+
.with_handle(handle)
310+
}
295311

296312
#[test]
297313
fn reading_nested_packs_works() {
298314
block_on(|handle| async move {
299-
let session = SESSION.clone().with_handle(handle);
315+
let session = session_with_handle(handle);
300316
let strategy = DictStrategy::new(
301317
FlatLayoutStrategy::default(),
302318
FlatLayoutStrategy::default(),
@@ -347,7 +363,7 @@ mod tests {
347363
);
348364
assert!(layout.encoding_id() == LayoutId::new_ref("vortex.dict"));
349365
let actual = layout
350-
.new_reader("".into(), segments, &SESSION)
366+
.new_reader("".into(), segments, &session)
351367
.unwrap()
352368
.projection_evaluation(
353369
&(0..layout.row_count()),
@@ -395,7 +411,7 @@ mod tests {
395411
#[case] expected: Vec<bool>,
396412
) {
397413
block_on(|handle| async move {
398-
let session = SESSION.clone().with_handle(handle);
414+
let session = session_with_handle(handle);
399415
let strategy = DictStrategy::new(
400416
FlatLayoutStrategy::default(),
401417
FlatLayoutStrategy::default(),
@@ -431,7 +447,7 @@ mod tests {
431447
)),
432448
);
433449
let mask = layout
434-
.new_reader("".into(), segments, &SESSION)
450+
.new_reader("".into(), segments, &session)
435451
.unwrap()
436452
.filter_evaluation(&(0..3), &filter, MaskFuture::new_true(3))
437453
.unwrap()
@@ -445,7 +461,7 @@ mod tests {
445461
#[test]
446462
fn reading_is_null_works() {
447463
block_on(|handle| async move {
448-
let session = SESSION.clone().with_handle(handle);
464+
let session = session_with_handle(handle);
449465
let strategy = DictStrategy::new(
450466
FlatLayoutStrategy::default(),
451467
FlatLayoutStrategy::default(),
@@ -491,7 +507,7 @@ mod tests {
491507
let expression = not(is_null(root())); // easier to test not_is_null b/c that's the validity array
492508
assert_eq!(layout.encoding_id(), LayoutId::new_ref("vortex.dict"));
493509
let actual = layout
494-
.new_reader("".into(), segments, &SESSION)
510+
.new_reader("".into(), segments, &session)
495511
.unwrap()
496512
.projection_evaluation(
497513
&(0..layout.row_count()),

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ impl LayoutStrategy for FlatLayoutStrategy {
161161

162162
let buffers = chunk.serialize(
163163
&ctx,
164-
&session,
164+
session,
165165
&SerializeOptions {
166166
offset: 0,
167167
include_padding: self.include_padding,

vortex-layout/src/layouts/repartition.rs

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -386,15 +386,17 @@ mod tests {
386386
);
387387

388388
let stream = fsl.into_array().to_array_stream().sequenced(ptr);
389-
let layout = block_on(|handle| {
389+
let layout = block_on(|handle| async move {
390390
let session = SESSION.clone().with_handle(handle);
391-
strategy.write_stream(
392-
ctx,
393-
Arc::<TestSegments>::clone(&segments),
394-
stream,
395-
eof,
396-
&session,
397-
)
391+
strategy
392+
.write_stream(
393+
ctx,
394+
Arc::<TestSegments>::clone(&segments),
395+
stream,
396+
eof,
397+
&session,
398+
)
399+
.await
398400
})?;
399401

400402
// The layout should be a ChunkedLayout with multiple children.
@@ -449,15 +451,17 @@ mod tests {
449451
);
450452

451453
let stream = elements.into_array().to_array_stream().sequenced(ptr);
452-
let layout = block_on(|handle| {
454+
let layout = block_on(|handle| async move {
453455
let session = SESSION.clone().with_handle(handle);
454-
strategy.write_stream(
455-
ctx,
456-
Arc::<TestSegments>::clone(&segments),
457-
stream,
458-
eof,
459-
&session,
460-
)
456+
strategy
457+
.write_stream(
458+
ctx,
459+
Arc::<TestSegments>::clone(&segments),
460+
stream,
461+
eof,
462+
&session,
463+
)
464+
.await
461465
})?;
462466

463467
assert_eq!(layout.row_count(), num_elements as u64);

0 commit comments

Comments
 (0)