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
Methods from Deref<Target = Array>§
Sourcepub fn encoding(&self) -> EncodingId
pub fn encoding(&self) -> EncodingId
Return the array’s encoding ID.
Sourcepub fn is_canonical(&self) -> bool
pub fn is_canonical(&self) -> bool
Whether the array is of a canonical encoding.
Sourcepub fn is_arrow(&self) -> bool
pub fn is_arrow(&self) -> bool
Whether the array is fully zero-copy to Arrow (including children). This means any nested types, like Structs, Lists, and Extensions are not present.
Sourcepub fn is_constant(&self) -> bool
pub fn is_constant(&self) -> bool
Return whether the array is constant.
Sourcepub fn as_constant(&self) -> Option<Scalar>
pub fn as_constant(&self) -> Option<Scalar>
Return scalar value of this array if the array is constant
pub fn child<'a>( &'a self, idx: usize, dtype: &'a DType, len: usize, ) -> VortexResult<Self>
Sourcepub fn children(&self) -> Vec<Array>
pub fn children(&self) -> Vec<Array>
Returns a Vec of Arrays with all the array’s child arrays.
Sourcepub fn named_children(&self) -> Vec<(String, Array)>
pub fn named_children(&self) -> Vec<(String, Array)>
Returns a Vec of Arrays with all the array’s child arrays.
pub fn depth_first_traversal(&self) -> ArrayChildrenIterator ⓘ
Sourcepub fn cumulative_nbuffers(&self) -> usize
pub fn cumulative_nbuffers(&self) -> usize
Count the number of cumulative buffers encoded by self.
Sourcepub fn all_buffer_offsets(&self, alignment: usize) -> Vec<u64>
pub fn all_buffer_offsets(&self, alignment: usize) -> Vec<u64>
Return the buffer offsets and the total length of all buffers, assuming the given alignment. This includes all child buffers.
pub fn metadata_bytes(&self) -> Option<&[u8]>
pub fn nbuffers(&self) -> usize
pub fn byte_buffer(&self, index: usize) -> Option<&ByteBuffer>
pub fn byte_buffers(&self) -> impl Iterator<Item = ByteBuffer> + '_
Sourcepub fn is_encoding(&self, id: EncodingId) -> bool
pub fn is_encoding(&self, id: EncodingId) -> bool
Checks whether array is of a given encoding.
pub fn try_downcast_ref<E: Encoding>(&self) -> VortexResult<(&E::Array, &E)>
Sourcepub fn nbytes(&self) -> usize
pub fn nbytes(&self) -> usize
Total size of the array in bytes, including all children and buffers.
pub fn statistics(&self) -> &(dyn Statistics + '_)
pub fn inherit_statistics(&self, parent: &dyn Statistics)
pub fn tree_display(&self) -> TreeDisplayWrapper<'_>
Sourcepub fn is_valid(&self, index: usize) -> VortexResult<bool>
pub fn is_valid(&self, index: usize) -> VortexResult<bool>
Return whether the element at the given index is valid (true) or null (false).
Sourcepub fn all_valid(&self) -> VortexResult<bool>
pub fn all_valid(&self) -> VortexResult<bool>
Return whether all elements in the array are valid.
Sourcepub fn null_count(&self) -> VortexResult<usize>
pub fn null_count(&self) -> VortexResult<usize>
Return the number of null elements in the array.
Sourcepub fn validity_mask(&self) -> VortexResult<Mask>
pub fn validity_mask(&self) -> VortexResult<Mask>
Return the canonical validity of the array as a Mask
.
pub fn as_null_array(&self) -> Option<&dyn NullArrayTrait>
pub fn as_bool_array(&self) -> Option<&dyn BoolArrayTrait>
pub fn as_primitive_array(&self) -> Option<&dyn PrimitiveArrayTrait>
pub fn as_utf8_array(&self) -> Option<&dyn Utf8ArrayTrait>
pub fn as_binary_array(&self) -> Option<&dyn BinaryArrayTrait>
pub fn as_struct_array(&self) -> Option<&dyn StructArrayTrait>
pub fn as_list_array(&self) -> Option<&dyn ListArrayTrait>
pub fn as_extension_array(&self) -> Option<&dyn ExtensionArrayTrait>
Trait Implementations§
Source§impl<T: NativePType> Accessor<T> for PrimitiveArray
impl<T: NativePType> Accessor<T> for PrimitiveArray
fn value_unchecked(&self, index: usize) -> T
fn decode_batch(&self, start_idx: usize) -> Vec<T>
fn batch_size(&self, start_idx: usize) -> usize
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<Array> for PrimitiveArray
impl AsRef<Array> for PrimitiveArray
Source§impl CanonicalVTable<PrimitiveArray> for PrimitiveEncoding
impl CanonicalVTable<PrimitiveArray> for PrimitiveEncoding
fn into_canonical(&self, array: PrimitiveArray) -> VortexResult<Canonical>
Source§impl CastFn<PrimitiveArray> for PrimitiveEncoding
impl CastFn<PrimitiveArray> for PrimitiveEncoding
fn cast(&self, array: &PrimitiveArray, dtype: &DType) -> VortexResult<Array>
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 Deref for PrimitiveArray
impl Deref for PrimitiveArray
Source§impl FillForwardFn<PrimitiveArray> for PrimitiveEncoding
impl FillForwardFn<PrimitiveArray> for PrimitiveEncoding
fn fill_forward(&self, array: &PrimitiveArray) -> VortexResult<Array>
Source§impl FillNullFn<PrimitiveArray> for PrimitiveEncoding
impl FillNullFn<PrimitiveArray> for PrimitiveEncoding
fn fill_null( &self, array: &PrimitiveArray, fill_value: Scalar, ) -> VortexResult<Array>
Source§impl FilterFn<PrimitiveArray> for PrimitiveEncoding
impl FilterFn<PrimitiveArray> for PrimitiveEncoding
Source§fn filter(&self, array: &PrimitiveArray, mask: &Mask) -> VortexResult<Array>
fn filter(&self, array: &PrimitiveArray, mask: &Mask) -> VortexResult<Array>
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 IntoArray for PrimitiveArray
impl IntoArray for PrimitiveArray
fn into_array(self) -> Array
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: &A,
values: &[Scalar],
side: SearchSortedSide,
) -> VortexResult<Vec<SearchResult>>
fn search_sorted_many( &self, array: &A, 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: &A, 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<Array>
fn slice( &self, array: &PrimitiveArray, start: usize, stop: usize, ) -> VortexResult<Array>
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: &Array) -> VortexResult<Array>
fn take(&self, array: &PrimitiveArray, indices: &Array) -> VortexResult<Array>
Source§unsafe fn take_unchecked(
&self,
array: &PrimitiveArray,
indices: &Array,
) -> VortexResult<Array>
unsafe fn take_unchecked( &self, array: &PrimitiveArray, indices: &Array, ) -> VortexResult<Array>
Source§impl ToArrowFn<PrimitiveArray> for PrimitiveEncoding
impl ToArrowFn<PrimitiveArray> for PrimitiveEncoding
Source§fn to_arrow(
&self,
primitive_array: &PrimitiveArray,
data_type: &DataType,
) -> VortexResult<Option<ArrayRef>>
fn to_arrow( &self, primitive_array: &PrimitiveArray, data_type: &DataType, ) -> VortexResult<Option<ArrayRef>>
Source§fn preferred_arrow_data_type(
&self,
_array: &A,
) -> VortexResult<Option<DataType>>
fn preferred_arrow_data_type( &self, _array: &A, ) -> VortexResult<Option<DataType>>
DataType
of the encoding, or None of the canonical
DataType
for the array’s Vortex vortex_dtype::DType
should be used.Source§impl<'a> TryFrom<&'a Array> for &'a PrimitiveArray
impl<'a> TryFrom<&'a Array> for &'a PrimitiveArray
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(data: &'a Array) -> VortexResult<Self>
fn try_from(data: &'a Array) -> VortexResult<Self>
Source§impl TryFrom<Array> for PrimitiveArray
impl TryFrom<Array> for PrimitiveArray
Source§type Error = VortexError
type Error = VortexError
Source§fn try_from(data: Array) -> VortexResult<Self>
fn try_from(data: Array) -> 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
Source§fn is_valid(&self, array: &PrimitiveArray, index: usize) -> VortexResult<bool>
fn is_valid(&self, array: &PrimitiveArray, index: usize) -> VortexResult<bool>
index
item is valid.Source§fn all_valid(&self, array: &PrimitiveArray) -> VortexResult<bool>
fn all_valid(&self, array: &PrimitiveArray) -> VortexResult<bool>
fn validity_mask(&self, array: &PrimitiveArray) -> VortexResult<Mask>
Source§fn invalid_count(&self, array: &Array) -> VortexResult<usize>
fn invalid_count(&self, array: &Array) -> VortexResult<usize>
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<()>
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> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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<A> IntoCanonical for Awhere
A: IntoArray,
impl<A> IntoCanonical for Awhere
A: IntoArray,
Source§fn into_canonical(self) -> Result<Canonical, VortexError>
fn into_canonical(self) -> Result<Canonical, 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 moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out
indicating that a T
is niched.