pub enum DataBlock {
AllNull(AllNullDataBlock),
Nullable(NullableDataBlock),
FixedWidth(FixedWidthDataBlock),
FixedSizeList(FixedSizeListBlock),
VariableWidth(VariableWidthBlock),
Opaque(OpaqueBlock),
Struct(StructDataBlock),
Dictionary(DictionaryDataBlock),
}Expand description
A DataBlock is a collection of buffers that represents an “array” of data in very generic terms
The output of each decoder is a DataBlock. Decoders can be chained together to transform one DataBlock into a different kind of DataBlock.
The DataBlock is somewhere in between Arrow’s ArrayData and Array and represents a physical layout of the data.
A DataBlock can be converted into an Arrow ArrayData (and then Array) for a given array type. For example, a FixedWidthDataBlock can be converted into any primitive type or a fixed size list of a primitive type. This is a zero-copy operation.
In addition, a DataBlock can be created from an Arrow array or arrays. This is not a zero-copy operation as some normalization may be required.
Variants§
AllNull(AllNullDataBlock)
Nullable(NullableDataBlock)
FixedWidth(FixedWidthDataBlock)
FixedSizeList(FixedSizeListBlock)
VariableWidth(VariableWidthBlock)
Opaque(OpaqueBlock)
Struct(StructDataBlock)
Dictionary(DictionaryDataBlock)
Implementations§
source§impl DataBlock
impl DataBlock
sourcepub fn into_arrow(
self,
data_type: DataType,
validate: bool,
) -> Result<ArrayData>
pub fn into_arrow( self, data_type: DataType, validate: bool, ) -> Result<ArrayData>
Convert self into an Arrow ArrayData
sourcepub fn into_buffers(self) -> Vec<LanceBuffer>
pub fn into_buffers(self) -> Vec<LanceBuffer>
Convert the data block into a collection of buffers for serialization
The order matters and will be used to reconstruct the data block at read time.
sourcepub fn borrow_and_clone(&mut self) -> Self
pub fn borrow_and_clone(&mut self) -> Self
Converts the data buffers into borrowed mode and clones the block
This is a zero-copy operation but requires a mutable reference to self and, afterwards, all buffers will be in Borrowed mode.
sourcepub fn try_clone(&self) -> Result<Self>
pub fn try_clone(&self) -> Result<Self>
Try and clone the block
This will fail if any buffers are in owned mode. You can call borrow_and_clone() to ensure that all buffers are in borrowed mode before calling this method.
pub fn name(&self) -> &'static str
pub fn num_values(&self) -> u64
source§impl DataBlock
impl DataBlock
pub fn as_all_null(self) -> Option<AllNullDataBlock>
pub fn as_nullable(self) -> Option<NullableDataBlock>
pub fn as_fixed_width(self) -> Option<FixedWidthDataBlock>
pub fn as_fixed_size_list(self) -> Option<FixedSizeListBlock>
pub fn as_variable_width(self) -> Option<VariableWidthBlock>
pub fn as_struct(self) -> Option<StructDataBlock>
pub fn as_dictionary(self) -> Option<DictionaryDataBlock>
source§impl DataBlock
impl DataBlock
pub fn from_arrays(arrays: &[ArrayRef], num_values: u64) -> Self
pub fn from_array<T: Array + 'static>(array: T) -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DataBlock
impl RefUnwindSafe for DataBlock
impl Send for DataBlock
impl Sync for DataBlock
impl Unpin for DataBlock
impl UnwindSafe for DataBlock
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> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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