Struct vortex_fastlanes::DeltaArray
source · pub struct DeltaArray(/* private fields */);
Implementations§
source§impl DeltaArray
impl DeltaArray
sourcepub fn maybe_from(data: impl AsRef<ArrayData>) -> Option<Self>
pub fn maybe_from(data: impl AsRef<ArrayData>) -> Option<Self>
Optionally downcast an ArrayData
instance to a specific encoding.
Preferred in cases where a backtrace isn’t needed, like when trying multiple encoding to go down different code paths.
source§impl DeltaArray
impl DeltaArray
A FastLanes-style delta-encoded array of primitive values.
A DeltaArray
comprises a sequence of chunks each representing 1,024 delta-encoded values,
except the last chunk which may represent from one to 1,024 values.
§Examples
use vortex_fastlanes::DeltaArray;
let array = DeltaArray::try_from_vec(vec![1_u32, 2, 3, 5, 10, 11]).unwrap();
§Details
To facilitate slicing, this array accepts an offset
and logical_len
. The offset must be
strictly less than 1,024 and the sum of offset
and logical_len
must not exceed the length of
the deltas
array. These values permit logical slicing without modifying any chunk containing a
kept value. In particular, we may defer decompresison until the array is canonicalized or
indexed. The offset
is a physical offset into the first chunk, which necessarily contains
1,024 values. The logical_len
is the number of logical values following the offset
, which
may be less than the number of physically stored values.
Each chunk is stored as a vector of bases and a vector of deltas. If the chunk physically
contains 1,024 vlaues, then there are as many bases as there are lanes of this type in a
1024-bit register. For example, for 64-bit values, there are 16 bases because there are 16
lanes. Each lane is a delta-encoding 1024 / bit_width
long vector of values. The deltas are stored in the
FastLanes order which splits the 1,024
values into one contiguous sub-sequence per-lane, thus permitting delta encoding.
If the chunk physically has fewer than 1,024 values, then it is stored as a traditional, non-SIMD-amenable, delta-encoded vector.
pub fn try_from_vec<T: NativePType>(vec: Vec<T>) -> VortexResult<Self>
pub fn try_from_primitive_array(array: &PrimitiveArray) -> VortexResult<Self>
pub fn try_from_delta_compress_parts( bases: ArrayData, deltas: ArrayData, validity: Validity, ) -> VortexResult<Self>
pub fn try_new( bases: ArrayData, deltas: ArrayData, validity: Validity, offset: usize, logical_len: usize, ) -> VortexResult<Self>
pub fn bases(&self) -> ArrayData
pub fn deltas(&self) -> ArrayData
sourcepub fn offset(&self) -> usize
pub fn offset(&self) -> usize
The logical offset into the first chunk of Self::deltas
.
pub fn validity(&self) -> Validity
Trait Implementations§
source§impl AsRef<ArrayData> for DeltaArray
impl AsRef<ArrayData> for DeltaArray
source§impl Clone for DeltaArray
impl Clone for DeltaArray
source§fn clone(&self) -> DeltaArray
fn clone(&self) -> DeltaArray
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for DeltaArray
impl Debug for DeltaArray
source§impl IntoArrayData for DeltaArray
impl IntoArrayData for DeltaArray
fn into_array(self) -> ArrayData
source§impl IntoCanonical for DeltaArray
impl IntoCanonical for DeltaArray
fn into_canonical(self) -> VortexResult<Canonical>
fn into_arrow(self) -> Result<Arc<dyn Array>, VortexError>where
Self: Sized,
source§impl PrimitiveArrayTrait for DeltaArray
impl PrimitiveArrayTrait for DeltaArray
source§impl ScalarAtFn<DeltaArray> for DeltaEncoding
impl ScalarAtFn<DeltaArray> for DeltaEncoding
fn scalar_at(&self, array: &DeltaArray, index: usize) -> VortexResult<Scalar>
source§impl SliceFn<DeltaArray> for DeltaEncoding
impl SliceFn<DeltaArray> for DeltaEncoding
source§fn slice(
&self,
array: &DeltaArray,
start: usize,
stop: usize,
) -> VortexResult<ArrayData>
fn slice( &self, array: &DeltaArray, start: usize, stop: usize, ) -> VortexResult<ArrayData>
start
(inclusive) and end
(exclusive).
If start >= stop, returns an empty array of the same type as self
.
Assumes that start or stop are out of bounds, may panic otherwise.source§impl StatisticsVTable<DeltaArray> for DeltaEncoding
impl StatisticsVTable<DeltaArray> for DeltaEncoding
§fn compute_statistics(
&self,
_array: &Array,
_stat: Stat,
) -> Result<StatsSet, VortexError>
fn compute_statistics( &self, _array: &Array, _stat: Stat, ) -> Result<StatsSet, VortexError>
source§impl<'a> TryFrom<&'a ArrayData> for &'a DeltaArray
impl<'a> TryFrom<&'a ArrayData> for &'a DeltaArray
source§impl TryFrom<ArrayData> for DeltaArray
impl TryFrom<ArrayData> for DeltaArray
source§impl ValidityVTable<DeltaArray> for DeltaEncoding
impl ValidityVTable<DeltaArray> for DeltaEncoding
fn is_valid(&self, array: &DeltaArray, index: usize) -> bool
fn logical_validity(&self, array: &DeltaArray) -> LogicalValidity
source§impl VariantsVTable<DeltaArray> for DeltaEncoding
impl VariantsVTable<DeltaArray> for DeltaEncoding
fn as_primitive_array<'a>( &self, array: &'a DeltaArray, ) -> Option<&'a dyn PrimitiveArrayTrait>
fn as_null_array<'a>(&self, _array: &'a Array) -> Option<&'a dyn NullArrayTrait>
fn as_bool_array<'a>(&self, _array: &'a Array) -> Option<&'a dyn BoolArrayTrait>
fn as_utf8_array<'a>(&self, _array: &'a Array) -> Option<&'a dyn Utf8ArrayTrait>
fn as_binary_array<'a>( &self, _array: &'a Array, ) -> Option<&'a dyn BinaryArrayTrait>
fn as_struct_array<'a>( &self, _array: &'a Array, ) -> Option<&'a dyn StructArrayTrait>
fn as_list_array<'a>(&self, _array: &'a Array) -> Option<&'a dyn ListArrayTrait>
fn as_extension_array<'a>( &self, _array: &'a Array, ) -> Option<&'a dyn ExtensionArrayTrait>
source§impl VisitorVTable<DeltaArray> for DeltaEncoding
impl VisitorVTable<DeltaArray> for DeltaEncoding
fn accept( &self, array: &DeltaArray, visitor: &mut dyn ArrayVisitor, ) -> VortexResult<()>
impl ArrayTrait for DeltaArray
Auto Trait Implementations§
impl !Freeze for DeltaArray
impl !RefUnwindSafe for DeltaArray
impl Send for DeltaArray
impl Sync for DeltaArray
impl Unpin for DeltaArray
impl !UnwindSafe for DeltaArray
Blanket Implementations§
§impl<T> ArrayStatistics for Twhere
T: AsRef<ArrayData>,
impl<T> ArrayStatistics for Twhere
T: AsRef<ArrayData>,
fn statistics(&self) -> &dyn Statistics
fn inherit_statistics(&self, parent: &dyn Statistics)
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoArrayVariant for Twhere
T: IntoCanonical,
impl<T> IntoArrayVariant for Twhere
T: IntoCanonical,
fn into_null(self) -> Result<NullArray, VortexError>
fn into_bool(self) -> Result<BoolArray, VortexError>
fn into_primitive(self) -> Result<PrimitiveArray, VortexError>
fn into_struct(self) -> Result<StructArray, VortexError>
fn into_list(self) -> Result<ListArray, VortexError>
fn into_varbinview(self) -> Result<VarBinViewArray, VortexError>
fn into_extension(self) -> Result<ExtensionArray, VortexError>
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