Skip to content

Commit e6e7e90

Browse files
committed
Fix tests
Signed-off-by: Adam Gutglick <adam@spiraldb.com>
1 parent b740548 commit e6e7e90

2 files changed

Lines changed: 54 additions & 26 deletions

File tree

encodings/fastlanes/src/bitpacking/compute/compare.rs

Lines changed: 54 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -492,26 +492,23 @@ mod tests {
492492
use crate::BitPackedArrayExt;
493493
use crate::bitpack_compress::bitpack_encode;
494494

495-
fn bp(array: &PrimitiveArray, bit_width: u8) -> crate::BitPackedArray {
496-
bitpack_encode(
497-
array,
498-
bit_width,
499-
None,
500-
&mut LEGACY_SESSION.create_execution_ctx(),
501-
)
502-
.unwrap()
503-
}
504-
505495
#[test]
506496
fn compare_unsigned_constant() {
507-
let array = bp(&PrimitiveArray::from_iter([1u32, 2, 3, 4, 5]), 3);
497+
let mut ctx = LEGACY_SESSION.create_execution_ctx();
498+
let array = bitpack_encode(
499+
&PrimitiveArray::from_iter([1u32, 2, 3, 4, 5]),
500+
3,
501+
None,
502+
&mut ctx,
503+
)
504+
.unwrap();
508505
let rhs = ConstantArray::new(3u32, array.len()).into_array();
509506

510507
let result = <BitPacked as CompareKernel>::compare(
511508
array.as_view(),
512509
&rhs,
513510
CompareOperator::Gt,
514-
&mut LEGACY_SESSION.create_execution_ctx(),
511+
&mut ctx,
515512
)
516513
.unwrap()
517514
.unwrap();
@@ -524,14 +521,21 @@ mod tests {
524521

525522
#[test]
526523
fn compare_signed_constant() {
527-
let array = bp(&PrimitiveArray::from_iter([1i32, 2, 3, 4, 5]), 3);
524+
let mut ctx = LEGACY_SESSION.create_execution_ctx();
525+
let array = bitpack_encode(
526+
&PrimitiveArray::from_iter([1i32, 2, 3, 4, 5]),
527+
3,
528+
None,
529+
&mut ctx,
530+
)
531+
.unwrap();
528532
let rhs = ConstantArray::new(2i32, array.len()).into_array();
529533

530534
let result = <BitPacked as CompareKernel>::compare(
531535
array.as_view(),
532536
&rhs,
533537
CompareOperator::Gte,
534-
&mut LEGACY_SESSION.create_execution_ctx(),
538+
&mut ctx,
535539
)
536540
.unwrap()
537541
.unwrap();
@@ -544,15 +548,17 @@ mod tests {
544548

545549
#[test]
546550
fn compare_with_patches() {
547-
let array = bp(&PrimitiveArray::from_iter(0u32..257), 8);
551+
let mut ctx = LEGACY_SESSION.create_execution_ctx();
552+
let array =
553+
bitpack_encode(&PrimitiveArray::from_iter(0u32..257), 8, None, &mut ctx).unwrap();
548554
assert!(array.patches().is_some());
549555

550556
let rhs = ConstantArray::new(256u32, array.len()).into_array();
551557
let result = <BitPacked as CompareKernel>::compare(
552558
array.as_view(),
553559
&rhs,
554560
CompareOperator::Eq,
555-
&mut LEGACY_SESSION.create_execution_ctx(),
561+
&mut ctx,
556562
)
557563
.unwrap()
558564
.unwrap();
@@ -565,17 +571,21 @@ mod tests {
565571

566572
#[test]
567573
fn compare_nullable() {
568-
let array = bp(
574+
let mut ctx = LEGACY_SESSION.create_execution_ctx();
575+
let array = bitpack_encode(
569576
&PrimitiveArray::from_option_iter([Some(1u16), None, Some(3), Some(4), None]),
570577
3,
571-
);
578+
None,
579+
&mut ctx,
580+
)
581+
.unwrap();
572582
let rhs = ConstantArray::new(3u16, array.len()).into_array();
573583

574584
let result = <BitPacked as CompareKernel>::compare(
575585
array.as_view(),
576586
&rhs,
577587
CompareOperator::Eq,
578-
&mut LEGACY_SESSION.create_execution_ctx(),
588+
&mut ctx,
579589
)
580590
.unwrap()
581591
.unwrap();
@@ -588,13 +598,21 @@ mod tests {
588598

589599
#[test]
590600
fn binary_compare_pushdown_executes() {
591-
let array = bp(&PrimitiveArray::from_iter([1u32, 2, 3, 4, 5]), 3).into_array();
601+
let mut ctx = LEGACY_SESSION.create_execution_ctx();
602+
let array = bitpack_encode(
603+
&PrimitiveArray::from_iter([1u32, 2, 3, 4, 5]),
604+
3,
605+
None,
606+
&mut ctx,
607+
)
608+
.unwrap()
609+
.into_array();
592610
let rhs = ConstantArray::new(4u32, array.len()).into_array();
593611

594612
let result = array
595613
.binary(rhs, CompareOperator::Lt.into())
596614
.unwrap()
597-
.execute::<Canonical>(&mut LEGACY_SESSION.create_execution_ctx())
615+
.execute::<Canonical>(&mut ctx)
598616
.unwrap()
599617
.into_array();
600618

@@ -606,7 +624,10 @@ mod tests {
606624

607625
#[test]
608626
fn between_executes_in_encoded_space() {
609-
let array = bp(&PrimitiveArray::from_iter(0u32..257), 8).into_array();
627+
let mut ctx = LEGACY_SESSION.create_execution_ctx();
628+
let array = bitpack_encode(&PrimitiveArray::from_iter(0u32..257), 8, None, &mut ctx)
629+
.unwrap()
630+
.into_array();
610631
let len = array.len();
611632

612633
let result = array
@@ -619,7 +640,7 @@ mod tests {
619640
},
620641
)
621642
.unwrap()
622-
.execute::<Canonical>(&mut LEGACY_SESSION.create_execution_ctx())
643+
.execute::<Canonical>(&mut ctx)
623644
.unwrap()
624645
.into_array();
625646

@@ -631,7 +652,15 @@ mod tests {
631652

632653
#[test]
633654
fn between_strict_upper() {
634-
let array = bp(&PrimitiveArray::from_iter([10i32, 11, 12, 13]), 4).into_array();
655+
let mut ctx = LEGACY_SESSION.create_execution_ctx();
656+
let array = bitpack_encode(
657+
&PrimitiveArray::from_iter([10i32, 11, 12, 13]),
658+
4,
659+
None,
660+
&mut ctx,
661+
)
662+
.unwrap()
663+
.into_array();
635664
let len = array.len();
636665

637666
let result = array
@@ -644,7 +673,7 @@ mod tests {
644673
},
645674
)
646675
.unwrap()
647-
.execute::<Canonical>(&mut LEGACY_SESSION.create_execution_ctx())
676+
.execute::<Canonical>(&mut ctx)
648677
.unwrap()
649678
.into_array();
650679

encodings/zstd/src/zstd_buffers.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ use vortex_array::scalar::Scalar;
2626
use vortex_array::serde::ArrayChildren;
2727
use vortex_array::session::ArraySessionExt;
2828
use vortex_array::validity::Validity;
29-
use vortex_array::vtable;
3029
use vortex_array::vtable::OperationsVTable;
3130
use vortex_array::vtable::VTable;
3231
use vortex_array::vtable::ValidityVTable;

0 commit comments

Comments
 (0)