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 ptype(&self) -> PType
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
Methods from Deref<Target = dyn Array>§
pub fn is_constant(&self) -> bool
pub fn is_constant_opts(&self, cost: Cost) -> bool
pub fn as_constant(&self) -> Option<Scalar>
Sourcepub fn as_opt<V: VTable>(&self) -> Option<&V::Array>
pub fn as_opt<V: VTable>(&self) -> Option<&V::Array>
Returns the array downcast to the given A
.
Sourcepub fn nbytes(&self) -> usize
pub fn nbytes(&self) -> usize
Total size of the array in bytes, including all children and buffers.
Sourcepub fn to_array_iterator(&self) -> impl ArrayIterator + 'static
pub fn to_array_iterator(&self) -> impl ArrayIterator + 'static
Create an ArrayIterator
over the array.
Sourcepub fn serialize(
&self,
ctx: &ArrayContext,
options: &SerializeOptions,
) -> VortexResult<Vec<ByteBuffer>>
pub fn serialize( &self, ctx: &ArrayContext, options: &SerializeOptions, ) -> VortexResult<Vec<ByteBuffer>>
Serialize the array into a sequence of byte buffers that should be written contiguously. This function returns a vec to avoid copying data buffers.
Optionally, padding can be included to guarantee buffer alignment and ensure zero-copy reads within the context of an external file or stream. In this case, the alignment of the first byte buffer should be respected when writing the buffers to the stream or file.
The format of this blob is a sequence of data buffers, possible with prefixed padding,
followed by a flatbuffer containing an fba::Array
message, and ending with a
little-endian u32 describing the length of the flatbuffer message.
Sourcepub fn to_array_stream(&self) -> impl ArrayStream + 'static
pub fn to_array_stream(&self) -> impl ArrayStream + 'static
Create an ArrayStream
over the array.
pub fn tree_display(&self) -> impl Display
Sourcepub fn as_null_typed(&self) -> NullTyped<'_>
pub fn as_null_typed(&self) -> NullTyped<'_>
Downcasts the array for null-specific behavior.
Sourcepub fn as_bool_typed(&self) -> BoolTyped<'_>
pub fn as_bool_typed(&self) -> BoolTyped<'_>
Downcasts the array for bool-specific behavior.
Sourcepub fn as_primitive_typed(&self) -> PrimitiveTyped<'_>
pub fn as_primitive_typed(&self) -> PrimitiveTyped<'_>
Downcasts the array for primitive-specific behavior.
Sourcepub fn as_decimal_typed(&self) -> DecimalTyped<'_>
pub fn as_decimal_typed(&self) -> DecimalTyped<'_>
Downcasts the array for decimal-specific behavior.
Sourcepub fn as_utf8_typed(&self) -> Utf8Typed<'_>
pub fn as_utf8_typed(&self) -> Utf8Typed<'_>
Downcasts the array for utf8-specific behavior.
Sourcepub fn as_binary_typed(&self) -> BinaryTyped<'_>
pub fn as_binary_typed(&self) -> BinaryTyped<'_>
Downcasts the array for binary-specific behavior.
Sourcepub fn as_struct_typed(&self) -> StructTyped<'_>
pub fn as_struct_typed(&self) -> StructTyped<'_>
Downcasts the array for struct-specific behavior.
Sourcepub fn as_list_typed(&self) -> ListTyped<'_>
pub fn as_list_typed(&self) -> ListTyped<'_>
Downcasts the array for list-specific behavior.
Sourcepub fn as_extension_typed(&self) -> ExtensionTyped<'_>
pub fn as_extension_typed(&self) -> ExtensionTyped<'_>
Downcasts the array for extension-specific behavior.
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 AsRef<dyn Array> for PrimitiveArray
impl AsRef<dyn Array> for PrimitiveArray
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<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) -> ArrayRef
Source§impl ValidityHelper for PrimitiveArray
impl ValidityHelper 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> 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