Skip to content

Commit fc2c05e

Browse files
committed
is-null
Signed-off-by: Joe Isaacs <[email protected]>
1 parent 79580a7 commit fc2c05e

File tree

2 files changed

+10
-26
lines changed

2 files changed

+10
-26
lines changed

vortex-array/src/scalar_fns/is_null/mod.rs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,19 @@ use vortex_dtype::DType;
55
use vortex_dtype::Nullability::NonNullable;
66
use vortex_error::VortexResult;
77
use vortex_mask::Mask;
8+
use vortex_vector::bool::BoolVector;
89
use vortex_vector::Datum;
9-
use vortex_vector::Scalar;
1010
use vortex_vector::ScalarOps;
1111
use vortex_vector::Vector;
1212
use vortex_vector::VectorOps;
13-
use vortex_vector::bool::BoolScalar;
14-
use vortex_vector::bool::BoolVector;
1513

16-
use crate::expr::ChildName;
17-
use crate::expr::ExprId;
1814
use crate::expr::functions::ArgName;
1915
use crate::expr::functions::Arity;
2016
use crate::expr::functions::EmptyOptions;
2117
use crate::expr::functions::ExecutionArgs;
2218
use crate::expr::functions::VTable;
19+
use crate::expr::ChildName;
20+
use crate::expr::ExprId;
2321

2422
pub struct IsNull;
2523
impl VTable for IsNull {
@@ -45,14 +43,12 @@ impl VTable for IsNull {
4543
}
4644

4745
fn execute(&self, _: &Self::Options, args: &ExecutionArgs) -> VortexResult<Datum> {
48-
Ok(args.input_datums(0).as_ref().map2(
49-
|sc| sc.is_invalid().into(),
50-
|arr| {
51-
Vector::Bool(BoolVector::new(
52-
arr.validity().to_bit_buffer(),
53-
Mask::AllTrue(arr.len()),
54-
))
55-
},
56-
))
46+
Ok(match args.input_datums(0) {
47+
Datum::Scalar(sc) => Datum::Scalar(sc.is_invalid().into()),
48+
Datum::Vector(vec) => Vector::Bool(BoolVector::new(
49+
vec.validity().to_bit_buffer(),
50+
Mask::AllTrue(vec.len()),
51+
)).into()
52+
})
5753
}
5854
}

vortex-vector/src/datum.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,6 @@ impl Datum {
8181
Datum::Vector(vector) => Some(vector),
8282
}
8383
}
84-
85-
/// Maps over the scalar or vector value, applying the appropriate function based on the variant.
86-
pub fn map2(
87-
self,
88-
sc_fn: impl FnOnce(Scalar) -> Scalar,
89-
arr_fn: impl FnOnce(Vector) -> Vector,
90-
) -> Datum {
91-
match self {
92-
Datum::Scalar(scalar) => Datum::Scalar(sc_fn(scalar)),
93-
Datum::Vector(vector) => Datum::Vector(arr_fn(vector)),
94-
}
95-
}
9684
}
9785

9886
impl Datum {

0 commit comments

Comments
 (0)