pub struct PrimitiveArray(/* private fields */);
Implementations§
Source§impl PrimitiveArray
impl PrimitiveArray
pub fn patch(self, patches: Patches) -> VortexResult<Self>
Source§impl PrimitiveArray
impl PrimitiveArray
pub fn new<T: NativePType>( buffer: impl Into<Buffer<T>>, validity: Validity, ) -> Self
pub fn empty<T: NativePType>(nullability: Nullability) -> Self
pub fn from_byte_buffer( buffer: ByteBuffer, ptype: PType, validity: Validity, ) -> Self
Sourcepub fn from_option_iter<T: NativePType, I: IntoIterator<Item = Option<T>>>(
iter: I,
) -> Self
pub fn from_option_iter<T: NativePType, I: IntoIterator<Item = Option<T>>>( iter: I, ) -> Self
Create a PrimitiveArray from an iterator of T
.
NOTE: we cannot impl FromIterator trait since it conflicts with FromIterator<T>
.
pub fn validity(&self) -> Validity
pub fn byte_buffer(&self) -> &ByteBuffer
pub fn into_byte_buffer(self) -> ByteBuffer
pub fn buffer<T: NativePType>(&self) -> Buffer<T>
pub fn into_buffer<T: NativePType>(self) -> Buffer<T>
Sourcepub fn into_buffer_mut<T: NativePType>(self) -> BufferMut<T>
pub fn into_buffer_mut<T: NativePType>(self) -> BufferMut<T>
Extract a mutable buffer from the PrimitiveArray. Attempts to do this with zero-copy if the buffer is uniquely owned, otherwise will make a copy.
Sourcepub fn try_into_buffer_mut<T: NativePType>(
self,
) -> Result<BufferMut<T>, PrimitiveArray>
pub fn try_into_buffer_mut<T: NativePType>( self, ) -> Result<BufferMut<T>, PrimitiveArray>
Try to extract a mutable buffer from the PrimitiveArray with zero copy.
Sourcepub fn map_each<T, R, F>(self, f: F) -> PrimitiveArray
pub fn map_each<T, R, F>(self, f: F) -> PrimitiveArray
Map each element in the array to a new value.
This ignores validity and maps over all maybe-null elements.
TODO(ngates): we could be smarter here if validity is sparse and only run the function over the valid elements.
Sourcepub fn as_slice<T: NativePType>(&self) -> &[T]
pub fn as_slice<T: NativePType>(&self) -> &[T]
Return a slice of the array’s buffer.
NOTE: these values may be nonsense if the validity buffer indicates that the value is null.
pub fn get_as_cast<T: NativePType>(&self, idx: usize) -> T
pub fn reinterpret_cast(&self, ptype: PType) -> Self
Trait Implementations§
Source§impl<T: NativePType> Accessor<T> for PrimitiveArray
impl<T: NativePType> Accessor<T> for PrimitiveArray
Source§impl<T: NativePType> ArrayAccessor<T> for PrimitiveArray
impl<T: NativePType> ArrayAccessor<T> for PrimitiveArray
Source§fn with_iterator<F, R>(&self, f: F) -> VortexResult<R>
fn with_iterator<F, R>(&self, f: F) -> VortexResult<R>
Source§impl AsRef<ArrayData> for PrimitiveArray
impl AsRef<ArrayData> for PrimitiveArray
Source§impl CastFn<PrimitiveArray> for PrimitiveEncoding
impl CastFn<PrimitiveArray> for PrimitiveEncoding
fn cast(&self, array: &PrimitiveArray, dtype: &DType) -> VortexResult<ArrayData>
Source§impl Clone for PrimitiveArray
impl Clone for PrimitiveArray
Source§fn clone(&self) -> PrimitiveArray
fn clone(&self) -> PrimitiveArray
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for PrimitiveArray
impl Debug for PrimitiveArray
Source§impl FillForwardFn<PrimitiveArray> for PrimitiveEncoding
impl FillForwardFn<PrimitiveArray> for PrimitiveEncoding
fn fill_forward(&self, array: &PrimitiveArray) -> VortexResult<ArrayData>
Source§impl FillNullFn<PrimitiveArray> for PrimitiveEncoding
impl FillNullFn<PrimitiveArray> for PrimitiveEncoding
fn fill_null( &self, array: &PrimitiveArray, fill_value: Scalar, ) -> VortexResult<ArrayData>
Source§impl FilterFn<PrimitiveArray> for PrimitiveEncoding
impl FilterFn<PrimitiveArray> for PrimitiveEncoding
Source§fn filter(
&self,
array: &PrimitiveArray,
mask: &FilterMask,
) -> VortexResult<ArrayData>
fn filter( &self, array: &PrimitiveArray, mask: &FilterMask, ) -> VortexResult<ArrayData>
Source§impl<T: NativePType> FromIterator<T> for PrimitiveArray
impl<T: NativePType> FromIterator<T> for PrimitiveArray
Source§fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
Source§impl IntoArrayData for PrimitiveArray
impl IntoArrayData for PrimitiveArray
fn into_array(self) -> ArrayData
Source§impl IntoCanonical for PrimitiveArray
impl IntoCanonical for PrimitiveArray
fn into_canonical(self) -> VortexResult<Canonical>
fn into_arrow(self) -> VortexResult<ArrayRef>where
Self: Sized,
fn into_arrow_with_data_type(
self,
data_type: &DataType,
) -> VortexResult<ArrayRef>where
Self: Sized,
Source§impl PrimitiveArrayTrait for PrimitiveArray
impl PrimitiveArrayTrait for PrimitiveArray
Source§impl ScalarAtFn<PrimitiveArray> for PrimitiveEncoding
impl ScalarAtFn<PrimitiveArray> for PrimitiveEncoding
fn scalar_at( &self, array: &PrimitiveArray, index: usize, ) -> VortexResult<Scalar>
Source§impl SearchSortedFn<PrimitiveArray> for PrimitiveEncoding
impl SearchSortedFn<PrimitiveArray> for PrimitiveEncoding
fn search_sorted( &self, array: &PrimitiveArray, value: &Scalar, side: SearchSortedSide, ) -> VortexResult<SearchResult>
Source§fn search_sorted_many(
&self,
array: &Array,
values: &[Scalar],
side: SearchSortedSide,
) -> VortexResult<Vec<SearchResult>>
fn search_sorted_many( &self, array: &Array, values: &[Scalar], side: SearchSortedSide, ) -> VortexResult<Vec<SearchResult>>
Source§impl SearchSortedUsizeFn<PrimitiveArray> for PrimitiveEncoding
impl SearchSortedUsizeFn<PrimitiveArray> for PrimitiveEncoding
fn search_sorted_usize( &self, array: &PrimitiveArray, value: usize, side: SearchSortedSide, ) -> VortexResult<SearchResult>
fn search_sorted_usize_many( &self, array: &Array, values: &[usize], side: SearchSortedSide, ) -> VortexResult<Vec<SearchResult>>
Source§impl SliceFn<PrimitiveArray> for PrimitiveEncoding
impl SliceFn<PrimitiveArray> for PrimitiveEncoding
Source§fn slice(
&self,
array: &PrimitiveArray,
start: usize,
stop: usize,
) -> VortexResult<ArrayData>
fn slice( &self, array: &PrimitiveArray, 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<PrimitiveArray> for PrimitiveEncoding
impl StatisticsVTable<PrimitiveArray> for PrimitiveEncoding
Source§fn compute_statistics(
&self,
array: &PrimitiveArray,
stat: Stat,
) -> VortexResult<StatsSet>
fn compute_statistics( &self, array: &PrimitiveArray, stat: Stat, ) -> VortexResult<StatsSet>
Source§impl TakeFn<PrimitiveArray> for PrimitiveEncoding
impl TakeFn<PrimitiveArray> for PrimitiveEncoding
Source§fn take(
&self,
array: &PrimitiveArray,
indices: &ArrayData,
) -> VortexResult<ArrayData>
fn take( &self, array: &PrimitiveArray, indices: &ArrayData, ) -> VortexResult<ArrayData>
Source§unsafe fn take_unchecked(
&self,
array: &PrimitiveArray,
indices: &ArrayData,
) -> VortexResult<ArrayData>
unsafe fn take_unchecked( &self, array: &PrimitiveArray, indices: &ArrayData, ) -> VortexResult<ArrayData>
Source§impl<'a> TryFrom<&'a ArrayData> for &'a PrimitiveArray
impl<'a> TryFrom<&'a ArrayData> for &'a PrimitiveArray
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(data: &'a ArrayData) -> VortexResult<Self>
fn try_from(data: &'a ArrayData) -> VortexResult<Self>
Source§impl TryFrom<ArrayData> for PrimitiveArray
impl TryFrom<ArrayData> for PrimitiveArray
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(data: ArrayData) -> VortexResult<Self>
fn try_from(data: ArrayData) -> VortexResult<Self>
Source§impl ValidateVTable<PrimitiveArray> for PrimitiveEncoding
impl ValidateVTable<PrimitiveArray> for PrimitiveEncoding
fn validate(&self, array: &PrimitiveArray) -> VortexResult<()>
Source§impl ValidityVTable<PrimitiveArray> for PrimitiveEncoding
impl ValidityVTable<PrimitiveArray> for PrimitiveEncoding
fn is_valid(&self, array: &PrimitiveArray, index: usize) -> bool
fn logical_validity(&self, array: &PrimitiveArray) -> LogicalValidity
Source§impl VariantsVTable<PrimitiveArray> for PrimitiveEncoding
impl VariantsVTable<PrimitiveArray> for PrimitiveEncoding
fn as_primitive_array<'a>( &self, array: &'a PrimitiveArray, ) -> 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<PrimitiveArray> for PrimitiveEncoding
impl VisitorVTable<PrimitiveArray> for PrimitiveEncoding
fn accept( &self, array: &PrimitiveArray, visitor: &mut dyn ArrayVisitor, ) -> VortexResult<()>
impl ArrayTrait for PrimitiveArray
Auto Trait Implementations§
impl !Freeze for PrimitiveArray
impl !RefUnwindSafe for PrimitiveArray
impl Send for PrimitiveArray
impl Sync for PrimitiveArray
impl Unpin for PrimitiveArray
impl !UnwindSafe for PrimitiveArray
Blanket Implementations§
Source§impl<T> ArrayEncodingRef for T
impl<T> ArrayEncodingRef for T
fn encoding(&self) -> &'static dyn EncodingVTable
Source§impl<A> ArrayNBytes for A
impl<A> ArrayNBytes for A
Source§impl<T> ArrayStatistics for T
impl<T> ArrayStatistics for T
fn statistics(&self) -> &dyn Statistics
fn inherit_statistics(&self, parent: &dyn Statistics)
Source§impl<A> ArrayValidity for A
impl<A> ArrayValidity for A
Source§fn is_valid(&self, index: usize) -> bool
fn is_valid(&self, index: usize) -> bool
Return whether the element at the given index is valid (true) or null (false).
Source§fn logical_validity(&self) -> LogicalValidity
fn logical_validity(&self) -> LogicalValidity
Return the logical validity of the array.
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> 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