Skip to content

Commit 3bbfa4b

Browse files
committed
Allow nullable children of MaskedArray
Signed-off-by: Nicholas Gates <nick@nickgates.com>
1 parent 6a0f257 commit 3bbfa4b

File tree

13 files changed

+63
-57
lines changed

13 files changed

+63
-57
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@
33

44
use vortex_buffer::BufferHandle;
55
use vortex_dtype::DType;
6-
use vortex_error::vortex_bail;
76
use vortex_error::VortexExpect;
87
use vortex_error::VortexResult;
9-
use vortex_vector::bool::BoolVector;
8+
use vortex_error::vortex_bail;
109
use vortex_vector::Vector;
10+
use vortex_vector::bool::BoolVector;
1111

12+
use crate::DeserializeMetadata;
13+
use crate::ProstMetadata;
14+
use crate::SerializeMetadata;
1215
use crate::arrays::BoolArray;
1316
use crate::execution::ExecutionCtx;
1417
use crate::serde::ArrayChildren;
@@ -18,9 +21,6 @@ use crate::vtable::ArrayVTableExt;
1821
use crate::vtable::NotSupported;
1922
use crate::vtable::VTable;
2023
use crate::vtable::ValidityVTableFromValidityHelper;
21-
use crate::DeserializeMetadata;
22-
use crate::ProstMetadata;
23-
use crate::SerializeMetadata;
2424

2525
mod array;
2626
mod canonical;

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,20 @@
44
use vortex_buffer::Alignment;
55
use vortex_buffer::Buffer;
66
use vortex_buffer::BufferHandle;
7-
use vortex_dtype::match_each_decimal_value_type;
87
use vortex_dtype::DType;
98
use vortex_dtype::NativeDecimalType;
109
use vortex_dtype::PrecisionScale;
10+
use vortex_dtype::match_each_decimal_value_type;
11+
use vortex_error::VortexResult;
1112
use vortex_error::vortex_bail;
1213
use vortex_error::vortex_ensure;
13-
use vortex_error::VortexResult;
1414
use vortex_scalar::DecimalType;
15-
use vortex_vector::decimal::DVector;
1615
use vortex_vector::Vector;
16+
use vortex_vector::decimal::DVector;
1717

18+
use crate::DeserializeMetadata;
19+
use crate::ProstMetadata;
20+
use crate::SerializeMetadata;
1821
use crate::arrays::DecimalArray;
1922
use crate::execution::ExecutionCtx;
2023
use crate::serde::ArrayChildren;
@@ -24,9 +27,6 @@ use crate::vtable::ArrayVTableExt;
2427
use crate::vtable::NotSupported;
2528
use crate::vtable::VTable;
2629
use crate::vtable::ValidityVTableFromValidityHelper;
27-
use crate::DeserializeMetadata;
28-
use crate::ProstMetadata;
29-
use crate::SerializeMetadata;
3030

3131
mod array;
3232
mod canonical;
@@ -139,18 +139,18 @@ pub struct DecimalVTable;
139139

140140
#[cfg(test)]
141141
mod tests {
142-
use vortex_buffer::buffer;
143142
use vortex_buffer::ByteBufferMut;
143+
use vortex_buffer::buffer;
144144
use vortex_dtype::DecimalDType;
145145

146+
use crate::ArrayContext;
147+
use crate::IntoArray;
146148
use crate::arrays::DecimalArray;
147149
use crate::arrays::DecimalVTable;
148150
use crate::serde::ArrayParts;
149151
use crate::serde::SerializeOptions;
150152
use crate::validity::Validity;
151153
use crate::vtable::ArrayVTableExt;
152-
use crate::ArrayContext;
153-
use crate::IntoArray;
154154

155155
#[test]
156156
fn test_array_serde() {

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

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

4-
use std::ops::{BitAnd, Not};
4+
use std::ops::BitAnd;
5+
use std::ops::Not;
6+
57
use vortex_dtype::DType;
6-
use vortex_error::vortex_bail;
78
use vortex_error::VortexResult;
9+
use vortex_error::vortex_bail;
810

11+
use crate::Array;
12+
use crate::ArrayRef;
913
use crate::compute::mask;
1014
use crate::stats::ArrayStats;
1115
use crate::validity::Validity;
12-
use crate::{Array, ArrayRef};
1316

1417
#[derive(Clone, Debug)]
1518
pub struct MaskedArray {

vortex-array/src/arrays/masked/compute/compare.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33

44
use vortex_error::VortexResult;
55

6+
use crate::Array;
7+
use crate::ArrayRef;
8+
use crate::IntoArray;
69
use crate::arrays::BoolArray;
710
use crate::arrays::MaskedArray;
811
use crate::arrays::MaskedVTable;
912
use crate::canonical::ToCanonical;
10-
use crate::compute::compare;
1113
use crate::compute::CompareKernel;
1214
use crate::compute::CompareKernelAdapter;
1315
use crate::compute::Operator;
16+
use crate::compute::compare;
1417
use crate::register_kernel;
1518
use crate::vtable::ValidityHelper;
16-
use crate::Array;
17-
use crate::ArrayRef;
18-
use crate::IntoArray;
1919

2020
impl CompareKernel for MaskedVTable {
2121
fn compare(
@@ -47,14 +47,14 @@ mod tests {
4747
use vortex_mask::Mask;
4848
use vortex_scalar::Scalar;
4949

50+
use crate::IntoArray;
51+
use crate::ToCanonical;
5052
use crate::arrays::ConstantArray;
5153
use crate::arrays::MaskedArray;
5254
use crate::arrays::PrimitiveArray;
53-
use crate::compute::compare;
5455
use crate::compute::Operator;
56+
use crate::compute::compare;
5557
use crate::validity::Validity;
56-
use crate::IntoArray;
57-
use crate::ToCanonical;
5858

5959
#[test]
6060
fn test_compare_value() {

vortex-array/src/arrays/masked/compute/filter.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
use vortex_error::VortexResult;
55
use vortex_mask::Mask;
66

7+
use crate::ArrayRef;
8+
use crate::IntoArray;
79
use crate::arrays::MaskedArray;
810
use crate::arrays::MaskedVTable;
9-
use crate::compute::filter;
1011
use crate::compute::FilterKernel;
1112
use crate::compute::FilterKernelAdapter;
13+
use crate::compute::filter;
1214
use crate::register_kernel;
13-
use crate::ArrayRef;
14-
use crate::IntoArray;
1515

1616
impl FilterKernel for MaskedVTable {
1717
fn filter(&self, array: &MaskedArray, mask: &Mask) -> VortexResult<ArrayRef> {
@@ -33,11 +33,11 @@ register_kernel!(FilterKernelAdapter(MaskedVTable).lift());
3333
mod tests {
3434
use rstest::rstest;
3535

36+
use crate::IntoArray;
3637
use crate::arrays::MaskedArray;
3738
use crate::arrays::PrimitiveArray;
3839
use crate::compute::conformance::filter::test_filter_conformance;
3940
use crate::validity::Validity;
40-
use crate::IntoArray;
4141

4242
#[rstest]
4343
#[case(

vortex-array/src/arrays/masked/compute/mask.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
use vortex_error::VortexResult;
55
use vortex_mask::Mask as MaskType;
66

7+
use crate::ArrayRef;
8+
use crate::IntoArray;
79
use crate::arrays::MaskedArray;
810
use crate::arrays::MaskedVTable;
911
use crate::compute::MaskKernel;
1012
use crate::compute::MaskKernelAdapter;
1113
use crate::register_kernel;
12-
use crate::ArrayRef;
13-
use crate::IntoArray;
1414

1515
impl MaskKernel for MaskedVTable {
1616
fn mask(&self, array: &MaskedArray, mask_arg: &MaskType) -> VortexResult<ArrayRef> {
@@ -28,11 +28,11 @@ register_kernel!(MaskKernelAdapter(MaskedVTable).lift());
2828
mod tests {
2929
use rstest::rstest;
3030

31+
use crate::IntoArray;
3132
use crate::arrays::MaskedArray;
3233
use crate::arrays::PrimitiveArray;
3334
use crate::compute::conformance::mask::test_mask_conformance;
3435
use crate::validity::Validity;
35-
use crate::IntoArray;
3636

3737
#[rstest]
3838
#[case(

vortex-array/src/arrays/masked/compute/take.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
use vortex_error::VortexResult;
55
use vortex_scalar::Scalar;
66

7+
use crate::Array;
8+
use crate::ArrayRef;
9+
use crate::IntoArray;
710
use crate::arrays::MaskedArray;
811
use crate::arrays::MaskedVTable;
9-
use crate::compute::fill_null;
10-
use crate::compute::take;
1112
use crate::compute::TakeKernel;
1213
use crate::compute::TakeKernelAdapter;
14+
use crate::compute::fill_null;
15+
use crate::compute::take;
1316
use crate::register_kernel;
14-
use crate::Array;
15-
use crate::ArrayRef;
16-
use crate::IntoArray;
1717

1818
impl TakeKernel for MaskedVTable {
1919
fn take(&self, array: &MaskedArray, indices: &dyn Array) -> VortexResult<ArrayRef> {
@@ -42,11 +42,11 @@ register_kernel!(TakeKernelAdapter(MaskedVTable).lift());
4242
mod tests {
4343
use rstest::rstest;
4444

45+
use crate::IntoArray;
4546
use crate::arrays::MaskedArray;
4647
use crate::arrays::PrimitiveArray;
4748
use crate::compute::conformance::take::test_take_conformance;
4849
use crate::validity::Validity;
49-
use crate::IntoArray;
5050

5151
#[rstest]
5252
#[case(

vortex-array/src/arrays/masked/vtable/canonical.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
// SPDX-FileCopyrightText: Copyright the Vortex contributors
33

44
use std::ops::Not;
5+
56
use vortex_error::VortexExpect;
67

8+
use crate::Array;
9+
use crate::Canonical;
710
use crate::arrays::ConstantVTable;
811
use crate::arrays::MaskedArray;
912
use crate::arrays::MaskedVTable;
1013
use crate::compute::mask;
1114
use crate::vtable::CanonicalVTable;
12-
use crate::Array;
13-
use crate::Canonical;
1415

1516
impl CanonicalVTable<MaskedVTable> for MaskedVTable {
1617
fn canonicalize(array: &MaskedArray) -> Canonical {
@@ -37,10 +38,10 @@ mod tests {
3738
use vortex_dtype::Nullability;
3839

3940
use super::*;
40-
use crate::arrays::PrimitiveArray;
41-
use crate::validity::Validity;
4241
use crate::IntoArray;
4342
use crate::ToCanonical;
43+
use crate::arrays::PrimitiveArray;
44+
use crate::validity::Validity;
4445

4546
#[rstest]
4647
#[case(

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ use prost::Message;
1010
use vortex_buffer::BufferHandle;
1111
use vortex_compute::mask::MaskValidity;
1212
use vortex_dtype::DType;
13-
use vortex_error::vortex_bail;
1413
use vortex_error::VortexResult;
14+
use vortex_error::vortex_bail;
1515
use vortex_vector::Vector;
1616

17+
use crate::ArrayBufferVisitor;
18+
use crate::ArrayChildVisitor;
1719
use crate::arrays::masked::MaskedArray;
1820
use crate::execution::ExecutionCtx;
1921
use crate::serde::ArrayChildren;
@@ -25,8 +27,6 @@ use crate::vtable::ArrayVTableExt;
2527
use crate::vtable::NotSupported;
2628
use crate::vtable::VTable;
2729
use crate::vtable::VisitorVTable;
28-
use crate::ArrayBufferVisitor;
29-
use crate::ArrayChildVisitor;
3030

3131
vtable!(Masked);
3232

@@ -134,15 +134,15 @@ mod tests {
134134
use rstest::rstest;
135135
use vortex_buffer::ByteBufferMut;
136136

137+
use crate::ArrayContext;
138+
use crate::IntoArray;
137139
use crate::arrays::MaskedArray;
138140
use crate::arrays::MaskedVTable;
139141
use crate::arrays::PrimitiveArray;
140142
use crate::serde::ArrayParts;
141143
use crate::serde::SerializeOptions;
142144
use crate::validity::Validity;
143145
use crate::vtable::ArrayVTableExt;
144-
use crate::ArrayContext;
145-
use crate::IntoArray;
146146

147147
#[rstest]
148148
#[case(

vortex-array/src/arrays/masked/vtable/validity.rs

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

4-
use crate::arrays::masked::MaskedArray;
5-
use crate::arrays::MaskedVTable;
6-
use crate::vtable::ValidityVTable;
7-
use crate::Array;
84
use std::ops::BitAnd;
5+
96
use vortex_mask::Mask;
107

8+
use crate::Array;
9+
use crate::arrays::MaskedVTable;
10+
use crate::arrays::masked::MaskedArray;
11+
use crate::vtable::ValidityVTable;
12+
1113
impl ValidityVTable<MaskedVTable> for MaskedVTable {
1214
fn is_valid(array: &MaskedArray, index: usize) -> bool {
1315
array.child.is_valid(index) && array.validity.is_valid(index)

0 commit comments

Comments
 (0)