Skip to content

Commit 10d04fa

Browse files
committed
Cleanup
Signed-off-by: Adam Gutglick <adam@spiraldb.com>
1 parent a71bf75 commit 10d04fa

3 files changed

Lines changed: 8 additions & 15 deletions

File tree

vortex-array/public-api.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15990,8 +15990,6 @@ pub fn vortex_array::scalar::Scalar::is_null(&self) -> bool
1599015990

1599115991
pub fn vortex_array::scalar::Scalar::is_valid(&self) -> bool
1599215992

15993-
pub fn vortex_array::scalar::Scalar::is_variant_null(&self) -> core::option::Option<bool>
15994-
1599515993
pub fn vortex_array::scalar::Scalar::is_zero(&self) -> core::option::Option<bool>
1599615994

1599715995
pub unsafe fn vortex_array::scalar::Scalar::new_unchecked(dtype: vortex_array::dtype::DType, value: core::option::Option<vortex_array::scalar::ScalarValue>) -> Self
@@ -16748,6 +16746,8 @@ pub fn vortex_array::scalar::VariantScalar<'a>::is_null(&self) -> bool
1674816746

1674916747
pub fn vortex_array::scalar::VariantScalar<'a>::is_variant_null(&self) -> core::option::Option<bool>
1675016748

16749+
pub fn vortex_array::scalar::VariantScalar<'a>::is_zero(&self) -> core::option::Option<bool>
16750+
1675116751
pub fn vortex_array::scalar::VariantScalar<'a>::value(&self) -> core::option::Option<&'a vortex_array::scalar::Scalar>
1675216752

1675316753
impl core::fmt::Display for vortex_array::scalar::VariantScalar<'_>

vortex-array/src/scalar/scalar_impl.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,6 @@ impl Scalar {
177177
/// Returns `None` if the scalar is null, otherwise returns `Some(true)` if the value is zero
178178
/// and `Some(false)` otherwise.
179179
pub fn is_zero(&self) -> Option<bool> {
180-
if self.dtype().is_variant() {
181-
return self.is_variant_null();
182-
}
183-
184180
let value = self.value()?;
185181

186182
let is_zero = match self.dtype() {
@@ -194,20 +190,12 @@ impl Scalar {
194190
DType::FixedSizeList(_, list_size, _) => value.as_list().len() == *list_size as usize,
195191
DType::Struct(struct_fields, _) => value.as_list().len() == struct_fields.nfields(),
196192
DType::Extension(_) => self.as_extension().to_storage_scalar().is_zero()?,
197-
DType::Variant(_) => unreachable!("handled above"),
193+
DType::Variant(_) => self.as_variant().is_zero()?,
198194
};
199195

200196
Some(is_zero)
201197
}
202198

203-
/// Returns whether a present variant scalar contains the variant-null payload.
204-
///
205-
/// Returns `None` for non-variant scalars and for outer-null variants.
206-
pub fn is_variant_null(&self) -> Option<bool> {
207-
self.as_variant_opt()
208-
.and_then(|variant| variant.is_variant_null())
209-
}
210-
211199
/// Reinterprets the bytes of this scalar as a different primitive type.
212200
///
213201
/// # Errors

vortex-array/src/scalar/typed_view/variant.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ impl<'a> VariantScalar<'a> {
6565
pub fn is_variant_null(&self) -> Option<bool> {
6666
Some(self.value?.is_null())
6767
}
68+
69+
/// Returns `Some(true)` if the inner [`Scalar`] has a non-null zero value.
70+
pub fn is_zero(&self) -> Option<bool> {
71+
self.value?.is_zero()
72+
}
6873
}
6974

7075
#[cfg(test)]

0 commit comments

Comments
 (0)