Skip to content

Commit a15d98d

Browse files
authored
Replace FilterMask with vortex-mask (#2056)
1 parent aacd52b commit a15d98d

File tree

47 files changed

+232
-762
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+232
-762
lines changed

Cargo.lock

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ vortex-fsst = { version = "0.22.1", path = "./encodings/fsst" }
158158
vortex-io = { version = "0.22.1", path = "./vortex-io" }
159159
vortex-ipc = { version = "0.22.1", path = "./vortex-ipc" }
160160
vortex-layout = { version = "0.22.1", path = "./vortex-layout" }
161+
vortex-mask = { version = "0.22.1", path = "./vortex-mask" }
161162
vortex-proto = { version = "0.22.1", path = "./vortex-proto" }
162163
vortex-runend = { version = "0.22.1", path = "./encodings/runend" }
163164
vortex-scalar = { version = "0.22.1", path = "./vortex-scalar", default-features = false }

encodings/alp/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ vortex-buffer = { workspace = true }
2525
vortex-dtype = { workspace = true }
2626
vortex-error = { workspace = true }
2727
vortex-fastlanes = { workspace = true }
28+
vortex-mask = { workspace = true }
2829
vortex-scalar = { workspace = true }
2930

3031
[dev-dependencies]

encodings/alp/src/alp/compute/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use vortex_array::compute::{
2-
filter, scalar_at, slice, take, ComputeVTable, FilterFn, FilterMask, ScalarAtFn, SliceFn,
3-
TakeFn,
2+
filter, scalar_at, slice, take, ComputeVTable, FilterFn, ScalarAtFn, SliceFn, TakeFn,
43
};
54
use vortex_array::variants::PrimitiveArrayTrait;
65
use vortex_array::{ArrayDType, ArrayData, IntoArrayData};
76
use vortex_error::VortexResult;
7+
use vortex_mask::Mask;
88
use vortex_scalar::Scalar;
99

1010
use crate::{match_each_alp_float_ptype, ALPArray, ALPEncoding, ALPFloat};
@@ -79,7 +79,7 @@ impl SliceFn<ALPArray> for ALPEncoding {
7979
}
8080

8181
impl FilterFn<ALPArray> for ALPEncoding {
82-
fn filter(&self, array: &ALPArray, mask: &FilterMask) -> VortexResult<ArrayData> {
82+
fn filter(&self, array: &ALPArray, mask: &Mask) -> VortexResult<ArrayData> {
8383
let patches = array
8484
.patches()
8585
.map(|p| p.filter(mask))

encodings/alp/src/alp_rd/compute/filter.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
use vortex_array::compute::{filter, FilterFn, FilterMask};
1+
use vortex_array::compute::{filter, FilterFn};
22
use vortex_array::{ArrayDType, ArrayData, IntoArrayData};
33
use vortex_error::VortexResult;
4+
use vortex_mask::Mask;
45

56
use crate::{ALPRDArray, ALPRDEncoding};
67

78
impl FilterFn<ALPRDArray> for ALPRDEncoding {
8-
fn filter(&self, array: &ALPRDArray, mask: &FilterMask) -> VortexResult<ArrayData> {
9+
fn filter(&self, array: &ALPRDArray, mask: &Mask) -> VortexResult<ArrayData> {
910
let left_parts_exceptions = array
1011
.left_parts_patches()
1112
.map(|patches| patches.filter(mask))
@@ -28,10 +29,11 @@ impl FilterFn<ALPRDArray> for ALPRDEncoding {
2829
mod test {
2930
use rstest::rstest;
3031
use vortex_array::array::PrimitiveArray;
31-
use vortex_array::compute::{filter, FilterMask};
32+
use vortex_array::compute::filter;
3233
use vortex_array::validity::Validity;
3334
use vortex_array::IntoArrayVariant;
3435
use vortex_buffer::buffer;
36+
use vortex_mask::Mask;
3537

3638
use crate::{ALPRDFloat, RDEncoder};
3739

@@ -46,13 +48,10 @@ mod test {
4648
assert!(encoded.left_parts_patches().is_some());
4749

4850
// The first two values need no patching
49-
let filtered = filter(
50-
encoded.as_ref(),
51-
&FilterMask::from_iter([true, false, true]),
52-
)
53-
.unwrap()
54-
.into_primitive()
55-
.unwrap();
51+
let filtered = filter(encoded.as_ref(), &Mask::from_iter([true, false, true]))
52+
.unwrap()
53+
.into_primitive()
54+
.unwrap();
5655
assert_eq!(filtered.as_slice::<T>(), &[a, outlier]);
5756
}
5857
}

encodings/datetime-parts/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ vortex-buffer = { workspace = true }
2323
vortex-datetime-dtype = { workspace = true }
2424
vortex-dtype = { workspace = true }
2525
vortex-error = { workspace = true }
26+
vortex-mask = { workspace = true }
2627
vortex-scalar = { workspace = true }
2728

2829
[dev-dependencies]

encodings/datetime-parts/src/compute/filter.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
use vortex_array::compute::{filter, FilterFn, FilterMask};
1+
use vortex_array::compute::{filter, FilterFn};
22
use vortex_array::{ArrayDType, ArrayData, IntoArrayData};
33
use vortex_error::VortexResult;
4+
use vortex_mask::Mask;
45

56
use crate::{DateTimePartsArray, DateTimePartsEncoding};
67

78
impl FilterFn<DateTimePartsArray> for DateTimePartsEncoding {
8-
fn filter(&self, array: &DateTimePartsArray, mask: &FilterMask) -> VortexResult<ArrayData> {
9+
fn filter(&self, array: &DateTimePartsArray, mask: &Mask) -> VortexResult<ArrayData> {
910
Ok(DateTimePartsArray::try_new(
1011
array.dtype().clone(),
1112
filter(array.days().as_ref(), mask)?,

encodings/dict/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ vortex-array = { workspace = true }
2121
vortex-buffer = { workspace = true }
2222
vortex-dtype = { workspace = true }
2323
vortex-error = { workspace = true }
24+
vortex-mask = { workspace = true }
2425
vortex-scalar = { workspace = true }
2526

2627
[lints]

encodings/dict/src/compute/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ mod compare;
33
mod like;
44

55
use vortex_array::compute::{
6-
filter, scalar_at, slice, take, BinaryNumericFn, CompareFn, ComputeVTable, FilterFn,
7-
FilterMask, LikeFn, ScalarAtFn, SliceFn, TakeFn,
6+
filter, scalar_at, slice, take, BinaryNumericFn, CompareFn, ComputeVTable, FilterFn, LikeFn,
7+
ScalarAtFn, SliceFn, TakeFn,
88
};
99
use vortex_array::{ArrayData, IntoArrayData};
1010
use vortex_error::VortexResult;
11+
use vortex_mask::Mask;
1112
use vortex_scalar::Scalar;
1213

1314
use crate::{DictArray, DictEncoding};
@@ -60,7 +61,7 @@ impl TakeFn<DictArray> for DictEncoding {
6061
}
6162

6263
impl FilterFn<DictArray> for DictEncoding {
63-
fn filter(&self, array: &DictArray, mask: &FilterMask) -> VortexResult<ArrayData> {
64+
fn filter(&self, array: &DictArray, mask: &Mask) -> VortexResult<ArrayData> {
6465
let codes = filter(&array.codes(), mask)?;
6566
DictArray::try_new(codes, array.values()).map(|a| a.into_array())
6667
}

encodings/fastlanes/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ vortex-array = { workspace = true }
2828
vortex-buffer = { workspace = true }
2929
vortex-dtype = { workspace = true }
3030
vortex-error = { workspace = true }
31+
vortex-mask = { workspace = true }
3132
vortex-scalar = { workspace = true }
3233

3334
[dev-dependencies]

0 commit comments

Comments
 (0)