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 map_each_with_validity<T, R, F>(
self,
f: F,
) -> VortexResult<PrimitiveArray>
pub fn map_each_with_validity<T, R, F>( self, f: F, ) -> VortexResult<PrimitiveArray>
Map each element in the array to a new value.
This doesn’t ignore validity and maps over all maybe-null elements, with a bool true if valid and false otherwise.
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 reinterpret_cast(&self, ptype: PType) -> Self
Trait Implementations§
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 ArrayCanonicalImpl for PrimitiveArray
impl ArrayCanonicalImpl for PrimitiveArray
Source§fn _to_canonical(&self) -> VortexResult<Canonical>
fn _to_canonical(&self) -> VortexResult<Canonical>
Source§fn _append_to_builder(&self, builder: &mut dyn ArrayBuilder) -> VortexResult<()>
fn _append_to_builder(&self, builder: &mut dyn ArrayBuilder) -> VortexResult<()>
Source§impl ArrayComputeImpl for PrimitiveArray
impl ArrayComputeImpl for PrimitiveArray
Source§impl ArrayImpl for PrimitiveArray
impl ArrayImpl for PrimitiveArray
Source§impl ArrayStatisticsImpl for PrimitiveArray
impl ArrayStatisticsImpl for PrimitiveArray
fn _stats_ref(&self) -> StatsSetRef<'_>
Source§impl ArrayValidityImpl for PrimitiveArray
impl ArrayValidityImpl for PrimitiveArray
Source§fn _is_valid(&self, index: usize) -> VortexResult<bool>
fn _is_valid(&self, index: usize) -> VortexResult<bool>
index
item is valid. Read moreSource§fn _all_valid(&self) -> VortexResult<bool>
fn _all_valid(&self) -> VortexResult<bool>
Source§fn _all_invalid(&self) -> VortexResult<bool>
fn _all_invalid(&self) -> VortexResult<bool>
Source§fn _validity_mask(&self) -> VortexResult<Mask>
fn _validity_mask(&self) -> VortexResult<Mask>
Source§fn _valid_count(&self) -> VortexResult<usize>
fn _valid_count(&self) -> VortexResult<usize>
Source§fn _invalid_count(&self) -> VortexResult<usize>
fn _invalid_count(&self) -> VortexResult<usize>
Source§impl ArrayVariantsImpl for PrimitiveArray
impl ArrayVariantsImpl for PrimitiveArray
Source§fn _as_primitive_typed(&self) -> Option<&dyn PrimitiveArrayTrait>
fn _as_primitive_typed(&self) -> Option<&dyn PrimitiveArrayTrait>
Source§fn _as_null_typed(&self) -> Option<&dyn NullArrayTrait>
fn _as_null_typed(&self) -> Option<&dyn NullArrayTrait>
Source§fn _as_bool_typed(&self) -> Option<&dyn BoolArrayTrait>
fn _as_bool_typed(&self) -> Option<&dyn BoolArrayTrait>
Source§fn _as_utf8_typed(&self) -> Option<&dyn Utf8ArrayTrait>
fn _as_utf8_typed(&self) -> Option<&dyn Utf8ArrayTrait>
Source§fn _as_binary_typed(&self) -> Option<&dyn BinaryArrayTrait>
fn _as_binary_typed(&self) -> Option<&dyn BinaryArrayTrait>
Source§fn _as_struct_typed(&self) -> Option<&dyn StructArrayTrait>
fn _as_struct_typed(&self) -> Option<&dyn StructArrayTrait>
Source§fn _as_list_typed(&self) -> Option<&dyn ListArrayTrait>
fn _as_list_typed(&self) -> Option<&dyn ListArrayTrait>
Source§fn _as_extension_typed(&self) -> Option<&dyn ExtensionArrayTrait>
fn _as_extension_typed(&self) -> Option<&dyn ExtensionArrayTrait>
Source§impl ArrayVisitorImpl for PrimitiveArray
impl ArrayVisitorImpl for PrimitiveArray
fn _visit_buffers(&self, visitor: &mut dyn ArrayBufferVisitor)
fn _visit_children(&self, visitor: &mut dyn ArrayChildVisitor)
fn _metadata(&self) -> EmptyMetadata
fn _nbuffers(&self) -> usize
fn _nchildren(&self) -> usize
Source§impl BetweenFn<&PrimitiveArray> for PrimitiveEncoding
impl BetweenFn<&PrimitiveArray> for PrimitiveEncoding
fn between( &self, arr: &PrimitiveArray, lower: &dyn Array, upper: &dyn Array, options: &BetweenOptions, ) -> VortexResult<Option<ArrayRef>>
Source§impl CastFn<&PrimitiveArray> for PrimitiveEncoding
impl CastFn<&PrimitiveArray> for PrimitiveEncoding
fn cast(&self, array: &PrimitiveArray, dtype: &DType) -> VortexResult<ArrayRef>
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<ArrayRef>
Source§impl FillNullFn<&PrimitiveArray> for PrimitiveEncoding
impl FillNullFn<&PrimitiveArray> for PrimitiveEncoding
fn fill_null( &self, array: &PrimitiveArray, fill_value: Scalar, ) -> VortexResult<ArrayRef>
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 IsConstantFn<&PrimitiveArray> for PrimitiveEncoding
impl IsConstantFn<&PrimitiveArray> for PrimitiveEncoding
Source§fn is_constant(
&self,
array: &PrimitiveArray,
_opts: &IsConstantOpts,
) -> VortexResult<Option<bool>>
fn is_constant( &self, array: &PrimitiveArray, _opts: &IsConstantOpts, ) -> VortexResult<Option<bool>>
Source§impl IsSortedFn<&PrimitiveArray> for PrimitiveEncoding
impl IsSortedFn<&PrimitiveArray> for PrimitiveEncoding
Source§fn is_sorted(&self, array: &PrimitiveArray) -> VortexResult<bool>
fn is_sorted(&self, array: &PrimitiveArray) -> VortexResult<bool>
fn is_strict_sorted(&self, array: &PrimitiveArray) -> VortexResult<bool>
Source§impl MaskFn<&PrimitiveArray> for PrimitiveEncoding
impl MaskFn<&PrimitiveArray> for PrimitiveEncoding
Source§fn mask(&self, array: &PrimitiveArray, mask: Mask) -> VortexResult<ArrayRef>
fn mask(&self, array: &PrimitiveArray, mask: Mask) -> VortexResult<ArrayRef>
Source§impl MinMaxFn<&PrimitiveArray> for PrimitiveEncoding
impl MinMaxFn<&PrimitiveArray> for PrimitiveEncoding
fn min_max(&self, array: &PrimitiveArray) -> VortexResult<Option<MinMaxResult>>
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<ArrayRef>
fn slice( &self, array: &PrimitiveArray, start: usize, stop: usize, ) -> VortexResult<ArrayRef>
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 SumFn<&PrimitiveArray> for PrimitiveEncoding
impl SumFn<&PrimitiveArray> for PrimitiveEncoding
Source§fn sum(&self, array: &PrimitiveArray) -> VortexResult<Scalar>
fn sum(&self, array: &PrimitiveArray) -> VortexResult<Scalar>
Source§impl TakeFn<&PrimitiveArray> for PrimitiveEncoding
impl TakeFn<&PrimitiveArray> for PrimitiveEncoding
Source§fn take(
&self,
array: &PrimitiveArray,
indices: &dyn Array,
) -> VortexResult<ArrayRef>
fn take( &self, array: &PrimitiveArray, indices: &dyn Array, ) -> VortexResult<ArrayRef>
Source§fn take_into(
&self,
array: &PrimitiveArray,
indices: &dyn Array,
builder: &mut dyn ArrayBuilder,
) -> VortexResult<()>
fn take_into( &self, array: &PrimitiveArray, indices: &dyn Array, builder: &mut dyn ArrayBuilder, ) -> VortexResult<()>
Self::take
but materializes the result into the provided
builder.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 UncompressedSizeFn<&PrimitiveArray> for PrimitiveEncoding
impl UncompressedSizeFn<&PrimitiveArray> for PrimitiveEncoding
Source§fn uncompressed_size(&self, array: &PrimitiveArray) -> VortexResult<usize>
fn uncompressed_size(&self, array: &PrimitiveArray) -> VortexResult<usize>
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<A> Array for Awhere
A: ArrayImpl + 'static,
impl<A> Array for Awhere
A: ArrayImpl + 'static,
Source§fn is_valid(&self, index: usize) -> Result<bool, VortexError>
fn is_valid(&self, index: usize) -> Result<bool, VortexError>
Returns whether the item at index
is valid.
Source§fn is_invalid(&self, index: usize) -> Result<bool, VortexError>
fn is_invalid(&self, index: usize) -> Result<bool, VortexError>
Returns whether the item at index
is invalid.
Source§fn all_valid(&self) -> Result<bool, VortexError>
fn all_valid(&self) -> Result<bool, VortexError>
Returns whether all items in the array are valid.
This is usually cheaper than computing a precise valid_count
.
Source§fn all_invalid(&self) -> Result<bool, VortexError>
fn all_invalid(&self) -> Result<bool, VortexError>
Returns whether the array is all invalid.
This is usually cheaper than computing a precise invalid_count
.
Source§fn valid_count(&self) -> Result<usize, VortexError>
fn valid_count(&self) -> Result<usize, VortexError>
Returns the number of valid elements in the array.
Source§fn invalid_count(&self) -> Result<usize, VortexError>
fn invalid_count(&self) -> Result<usize, VortexError>
Returns the number of invalid elements in the array.
Source§fn validity_mask(&self) -> Result<Mask, VortexError>
fn validity_mask(&self) -> Result<Mask, VortexError>
Returns the canonical validity mask for the array.
Source§fn to_canonical(&self) -> Result<Canonical, VortexError>
fn to_canonical(&self) -> Result<Canonical, VortexError>
Returns the canonical representation of the array.
Source§fn append_to_builder(
&self,
builder: &mut dyn ArrayBuilder,
) -> Result<(), VortexError>
fn append_to_builder( &self, builder: &mut dyn ArrayBuilder, ) -> Result<(), VortexError>
Writes the array into the canonical builder.
The DType
of the builder must match that of the array.
Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Any
trait object.Source§fn vtable(&self) -> ArcRef<dyn EncodingVTable>
fn vtable(&self) -> ArcRef<dyn EncodingVTable>
Source§fn find_kernel(&self, compute_fn: &dyn ComputeFn) -> Option<ArcRef<dyn Kernel>>
fn find_kernel(&self, compute_fn: &dyn ComputeFn) -> Option<ArcRef<dyn Kernel>>
Source§fn statistics(&self) -> StatsSetRef<'_>
fn statistics(&self) -> StatsSetRef<'_>
Source§fn with_children(
&self,
children: &[Arc<dyn Array>],
) -> Result<Arc<dyn Array>, VortexError>
fn with_children( &self, children: &[Arc<dyn Array>], ) -> Result<Arc<dyn Array>, VortexError>
Source§fn is_encoding(&self, encoding: EncodingId) -> bool
fn is_encoding(&self, encoding: EncodingId) -> bool
Source§fn is_canonical(&self) -> bool
fn is_canonical(&self) -> bool
Source§impl<A> ArrayIteratorArrayExt for A
impl<A> ArrayIteratorArrayExt for A
Source§fn to_array_iterator(&self) -> impl ArrayIterator + 'static
fn to_array_iterator(&self) -> impl ArrayIterator + 'static
ArrayIterator
over the array.Source§impl<A> ArrayStatistics for Awhere
A: Array + 'static,
impl<A> ArrayStatistics for Awhere
A: Array + 'static,
Source§fn is_constant(&self) -> bool
fn is_constant(&self) -> bool
Source§fn as_constant(&self) -> Option<Scalar>
fn as_constant(&self) -> Option<Scalar>
Self::is_constant
is true, return the actual constant value as a Scalar
.Source§impl<A> ArrayStreamArrayExt for A
impl<A> ArrayStreamArrayExt for A
Source§fn to_array_stream(&self) -> impl ArrayStream + 'static
fn to_array_stream(&self) -> impl ArrayStream + 'static
ArrayStream
over the array.Source§impl<A> ArrayVariants for Awhere
A: ArrayImpl,
impl<A> ArrayVariants for Awhere
A: ArrayImpl,
Source§fn as_null_typed(&self) -> Option<&dyn NullArrayTrait>
fn as_null_typed(&self) -> Option<&dyn NullArrayTrait>
Downcasts the array for null-specific behavior.
Source§fn as_bool_typed(&self) -> Option<&dyn BoolArrayTrait>
fn as_bool_typed(&self) -> Option<&dyn BoolArrayTrait>
Downcasts the array for bool-specific behavior.
Source§fn as_primitive_typed(&self) -> Option<&dyn PrimitiveArrayTrait>
fn as_primitive_typed(&self) -> Option<&dyn PrimitiveArrayTrait>
Downcasts the array for primitive-specific behavior.
Source§fn as_utf8_typed(&self) -> Option<&dyn Utf8ArrayTrait>
fn as_utf8_typed(&self) -> Option<&dyn Utf8ArrayTrait>
Downcasts the array for utf8-specific behavior.
Source§fn as_binary_typed(&self) -> Option<&dyn BinaryArrayTrait>
fn as_binary_typed(&self) -> Option<&dyn BinaryArrayTrait>
Downcasts the array for binary-specific behavior.
Source§fn as_struct_typed(&self) -> Option<&dyn StructArrayTrait>
fn as_struct_typed(&self) -> Option<&dyn StructArrayTrait>
Downcasts the array for struct-specific behavior.
Source§fn as_list_typed(&self) -> Option<&dyn ListArrayTrait>
fn as_list_typed(&self) -> Option<&dyn ListArrayTrait>
Downcasts the array for list-specific behavior.
Source§fn as_extension_typed(&self) -> Option<&dyn ExtensionArrayTrait>
fn as_extension_typed(&self) -> Option<&dyn ExtensionArrayTrait>
Downcasts the array for extension-specific behavior.
Source§impl<A> ArrayVisitor for Awhere
A: ArrayImpl,
impl<A> ArrayVisitor for Awhere
A: ArrayImpl,
Source§impl<A> ArrayVisitorExt for A
impl<A> ArrayVisitorExt for A
Source§fn nbuffers_recursive(&self) -> usize
fn nbuffers_recursive(&self) -> usize
Source§fn depth_first_traversal(&self) -> impl Iterator<Item = ArrayRef>
fn depth_first_traversal(&self) -> impl Iterator<Item = ArrayRef>
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 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.