Skip to content

Commit f8cab7a

Browse files
authored
Chore: use is_null instead of is_invalid for scalars (#5703)
I promise there's a reason for this Signed-off-by: Connor Tsui <[email protected]>
1 parent af0af75 commit f8cab7a

File tree

5 files changed

+4
-8
lines changed

5 files changed

+4
-8
lines changed

vortex-array/src/expr/exprs/is_null.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ impl VTable for IsNull {
9494
fn execute(&self, _data: &Self::Options, mut args: ExecutionArgs) -> VortexResult<Datum> {
9595
let child = args.datums.pop().vortex_expect("Missing input child");
9696
Ok(match child {
97-
Datum::Scalar(s) => Datum::Scalar(BoolScalar::new(Some(s.is_invalid())).into()),
97+
Datum::Scalar(s) => Datum::Scalar(BoolScalar::new(Some(s.is_null())).into()),
9898
Datum::Vector(v) => Datum::Vector(
9999
BoolVector::new(v.validity().to_bit_buffer().not(), Mask::new_true(v.len())).into(),
100100
),

vortex-vector/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ pub fn vector_matches_dtype(vector: &Vector, dtype: &DType) -> bool {
118118

119119
/// Returns true if the scalar's is compatible with the provided data type.
120120
pub fn scalar_matches_dtype(scalar: &Scalar, dtype: &DType) -> bool {
121-
if !dtype.is_nullable() && scalar.is_invalid() {
121+
if !dtype.is_nullable() && scalar.is_null() {
122122
// Non-nullable dtype cannot have nulls in the scalar.
123123
return false;
124124
}

vortex-vector/src/listview/vector_mut.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ impl VectorMutOps for ListViewVectorMut {
411411
}
412412

413413
fn append_scalars(&mut self, scalar: &ListViewScalar, n: usize) {
414-
if scalar.is_invalid() {
414+
if scalar.is_null() {
415415
self.append_nulls(n);
416416
return;
417417
}

vortex-vector/src/scalar.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ impl ScalarOps for Scalar {
4444
match_each_scalar!(self, |v| { v.is_valid() })
4545
}
4646

47-
fn is_invalid(&self) -> bool {
48-
!self.is_valid()
49-
}
50-
5147
fn mask_validity(&mut self, mask: bool) {
5248
match_each_scalar!(self, |v| { v.mask_validity(mask) })
5349
}

vortex-vector/src/scalar_ops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub trait ScalarOps: private::Sealed + Sized + Into<Scalar> {
1111
fn is_valid(&self) -> bool;
1212

1313
/// Returns true if the scalar is null.
14-
fn is_invalid(&self) -> bool {
14+
fn is_null(&self) -> bool {
1515
!self.is_valid()
1616
}
1717

0 commit comments

Comments
 (0)