pub struct RunEndArray { /* private fields */ }Implementations§
Source§impl RunEndArray
impl RunEndArray
Sourcepub fn new(ends: ArrayRef, values: ArrayRef) -> Self
pub fn new(ends: ArrayRef, values: ArrayRef) -> Self
Build a new RunEndArray from an array of run ends and an array of values.
Panics if any of the validation conditions described in RunEndArray::try_new is
not satisfied.
§Examples
let ends = buffer![2u8, 3u8].into_array();
let values = BoolArray::from_iter([false, true]).into_array();
let run_end = RunEndArray::new(ends, values);
// Array encodes
assert_eq!(run_end.scalar_at(0), false.into());
assert_eq!(run_end.scalar_at(1), false.into());
assert_eq!(run_end.scalar_at(2), true.into());Sourcepub fn try_new(ends: ArrayRef, values: ArrayRef) -> VortexResult<Self>
pub fn try_new(ends: ArrayRef, values: ArrayRef) -> VortexResult<Self>
Build a new RunEndArray from components.
§Validation
The ends must be non-nullable unsigned integers. The values may be Bool or Primitive
types.
All ends must be strictly monotonic. A run cannot be empty, therefore there can be no
duplicates in the ends.
§Examples
// Error to provide duplicate ends!
let result = RunEndArray::try_new(
buffer![1u8, 1u8, 2u8].into_array(),
buffer![100i32, 200i32, 300i32].into_array(),
);
assert!(result.is_err());
// Error to provide incorrectly-typed values!
let result = RunEndArray::try_new(
buffer![1u8, 2u8].into_array(),
VarBinViewArray::from_iter_str(["bad", "dtype"]).into_array(),
);
assert!(result.is_err());
// This array is happy
let result = RunEndArray::try_new(
buffer![1u8, 2u8].into_array(),
BoolArray::from_iter([false, true]).into_array(),
);
assert!(result.is_ok());Sourcepub fn try_new_offset_length(
ends: ArrayRef,
values: ArrayRef,
offset: usize,
length: usize,
) -> VortexResult<Self>
pub fn try_new_offset_length( ends: ArrayRef, values: ArrayRef, offset: usize, length: usize, ) -> VortexResult<Self>
Construct a new sliced RunEndArray with the provided offset and length.
This performs all the same validation as RunEndArray::try_new.
Sourcepub unsafe fn new_unchecked(
ends: ArrayRef,
values: ArrayRef,
offset: usize,
length: usize,
) -> Self
pub unsafe fn new_unchecked( ends: ArrayRef, values: ArrayRef, offset: usize, length: usize, ) -> Self
Build a new RunEndArray without validation.
§Safety
The caller must ensure that all the validation performed in RunEndArray::try_new is
satisfied before calling this function.
See RunEndArray::try_new for the preconditions needed to build a new array.
Sourcepub fn find_physical_index(&self, index: usize) -> usize
pub fn find_physical_index(&self, index: usize) -> usize
Convert the given logical index to an index into the values array
Sourcepub fn encode(array: ArrayRef) -> VortexResult<Self>
pub fn encode(array: ArrayRef) -> VortexResult<Self>
Run the array through run-end encoding.
Sourcepub fn offset(&self) -> usize
pub fn offset(&self) -> usize
The offset that the ends is relative to.
This is generally zero for a “new” array, and non-zero after a slicing operation.
Trait Implementations§
Source§impl AsRef<dyn Array> for RunEndArray
impl AsRef<dyn Array> for RunEndArray
Source§impl Clone for RunEndArray
impl Clone for RunEndArray
Source§fn clone(&self) -> RunEndArray
fn clone(&self) -> RunEndArray
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RunEndArray
impl Debug for RunEndArray
Source§impl Deref for RunEndArray
impl Deref for RunEndArray
Source§impl From<RunEndArray> for ArrayRef
impl From<RunEndArray> for ArrayRef
Source§fn from(value: RunEndArray) -> ArrayRef
fn from(value: RunEndArray) -> ArrayRef
Source§impl IntoArray for RunEndArray
impl IntoArray for RunEndArray
fn into_array(self) -> ArrayRef
Auto Trait Implementations§
impl Freeze for RunEndArray
impl !RefUnwindSafe for RunEndArray
impl Send for RunEndArray
impl Sync for RunEndArray
impl Unpin for RunEndArray
impl !UnwindSafe for RunEndArray
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more