pub struct LiquidByteViewArray<B: FsstBuffer> { /* private fields */ }Expand description
An array that stores strings using the FSST view format:
- Dictionary keys with 2-byte keys stored in memory
- Offset views with 4-byte offsets and 8-byte prefixes stored in memory
- FSST buffer can be stored in memory or on disk
Data access flow:
- Use dictionary key to index into offset_views buffer
- Use offset from offset_views to read the corresponding bytes from FSST buffer
- Use prefix from offset_views for quick comparisons to avoid decompression when possible
- Decompress bytes from FSST buffer to get the full value when needed
Implementations§
Source§impl LiquidByteViewArray<MemoryBuffer>
impl LiquidByteViewArray<MemoryBuffer>
Sourcepub fn from_bytes(
bytes: Bytes,
compressor: Arc<Compressor>,
) -> LiquidByteViewArray<MemoryBuffer>
pub fn from_bytes( bytes: Bytes, compressor: Arc<Compressor>, ) -> LiquidByteViewArray<MemoryBuffer>
Deserialize a LiquidByteViewArray from bytes.
Source§impl<B: FsstBuffer> LiquidByteViewArray<B>
impl<B: FsstBuffer> LiquidByteViewArray<B>
Sourcepub fn from_string_view_array(
array: &StringViewArray,
compressor: Arc<Compressor>,
) -> LiquidByteViewArray<MemoryBuffer>
pub fn from_string_view_array( array: &StringViewArray, compressor: Arc<Compressor>, ) -> LiquidByteViewArray<MemoryBuffer>
Create a LiquidByteViewArray from an Arrow StringViewArray
Sourcepub fn from_binary_view_array(
array: &BinaryViewArray,
compressor: Arc<Compressor>,
) -> LiquidByteViewArray<MemoryBuffer>
pub fn from_binary_view_array( array: &BinaryViewArray, compressor: Arc<Compressor>, ) -> LiquidByteViewArray<MemoryBuffer>
Create a LiquidByteViewArray from an Arrow BinaryViewArray
Sourcepub fn from_string_array(
array: &StringArray,
compressor: Arc<Compressor>,
) -> LiquidByteViewArray<MemoryBuffer>
pub fn from_string_array( array: &StringArray, compressor: Arc<Compressor>, ) -> LiquidByteViewArray<MemoryBuffer>
Create a LiquidByteViewArray from an Arrow StringArray
Sourcepub fn from_binary_array(
array: &BinaryArray,
compressor: Arc<Compressor>,
) -> LiquidByteViewArray<MemoryBuffer>
pub fn from_binary_array( array: &BinaryArray, compressor: Arc<Compressor>, ) -> LiquidByteViewArray<MemoryBuffer>
Create a LiquidByteViewArray from an Arrow BinaryArray
Sourcepub fn train_from_string_view(
array: &StringViewArray,
) -> (Arc<Compressor>, LiquidByteViewArray<MemoryBuffer>)
pub fn train_from_string_view( array: &StringViewArray, ) -> (Arc<Compressor>, LiquidByteViewArray<MemoryBuffer>)
Train a compressor from an Arrow StringViewArray
Sourcepub fn train_from_binary_view(
array: &BinaryViewArray,
) -> (Arc<Compressor>, LiquidByteViewArray<MemoryBuffer>)
pub fn train_from_binary_view( array: &BinaryViewArray, ) -> (Arc<Compressor>, LiquidByteViewArray<MemoryBuffer>)
Train a compressor from an Arrow BinaryViewArray
Sourcepub fn train_from_arrow<T: ByteArrayType>(
array: &GenericByteArray<T>,
) -> (Arc<Compressor>, LiquidByteViewArray<MemoryBuffer>)
pub fn train_from_arrow<T: ByteArrayType>( array: &GenericByteArray<T>, ) -> (Arc<Compressor>, LiquidByteViewArray<MemoryBuffer>)
Train a compressor from an Arrow ByteArray.
Sourcepub unsafe fn from_unique_dict_array(
array: &DictionaryArray<UInt16Type>,
compressor: Arc<Compressor>,
) -> LiquidByteViewArray<MemoryBuffer>
pub unsafe fn from_unique_dict_array( array: &DictionaryArray<UInt16Type>, compressor: Arc<Compressor>, ) -> LiquidByteViewArray<MemoryBuffer>
Only used when the dictionary is read from a trusted parquet reader, which reads a trusted parquet file, written by a trusted writer.
§Safety
The caller must ensure that the values in the dictionary are unique.
Sourcepub fn train_from_arrow_dict(
array: &DictionaryArray<UInt16Type>,
) -> (Arc<Compressor>, LiquidByteViewArray<MemoryBuffer>)
pub fn train_from_arrow_dict( array: &DictionaryArray<UInt16Type>, ) -> (Arc<Compressor>, LiquidByteViewArray<MemoryBuffer>)
Train a compressor from an Arrow DictionaryArray.
Sourcepub fn train_compressor<'a, T: ArrayAccessor<Item = &'a str>>(
array: ArrayIter<T>,
) -> Arc<Compressor> ⓘ
pub fn train_compressor<'a, T: ArrayAccessor<Item = &'a str>>( array: ArrayIter<T>, ) -> Arc<Compressor> ⓘ
Train a compressor from an iterator of strings
Sourcepub fn train_compressor_bytes<'a, T: ArrayAccessor<Item = &'a [u8]>>(
array: ArrayIter<T>,
) -> Arc<Compressor> ⓘ
pub fn train_compressor_bytes<'a, T: ArrayAccessor<Item = &'a [u8]>>( array: ArrayIter<T>, ) -> Arc<Compressor> ⓘ
Train a compressor from an iterator of byte arrays
Sourcepub fn to_dict_arrow(&self) -> Result<DictionaryArray<UInt16Type>, IoRange>
pub fn to_dict_arrow(&self) -> Result<DictionaryArray<UInt16Type>, IoRange>
Convert to Arrow DictionaryArray
Sourcepub fn to_arrow_array(&self) -> Result<ArrayRef, IoRange>
pub fn to_arrow_array(&self) -> Result<ArrayRef, IoRange>
Convert to Arrow array with original type
Sourcepub fn nulls(&self) -> Option<&NullBuffer>
pub fn nulls(&self) -> Option<&NullBuffer>
Get the nulls buffer
Sourcepub fn compare_with(
&self,
needle: &[u8],
op: &Operator,
) -> Result<BooleanArray, IoRange>
pub fn compare_with( &self, needle: &[u8], op: &Operator, ) -> Result<BooleanArray, IoRange>
Compare with prefix optimization and fallback to Arrow operations
Sourcepub fn get_detailed_memory_usage(&self) -> ByteViewArrayMemoryUsage
pub fn get_detailed_memory_usage(&self) -> ByteViewArrayMemoryUsage
Get detailed memory usage of the byte view array
Sourcepub fn sort_to_indices(&self) -> Result<UInt32Array, IoRange>
pub fn sort_to_indices(&self) -> Result<UInt32Array, IoRange>
Sort the array and return indices that would sort the array This implements efficient sorting as described in the design document:
- First sort the dictionary using prefixes to delay decompression
- If decompression is needed, decompress the entire array at once
- Use dictionary ranks to sort the final keys
Sourcepub fn is_fsst_buffer_on_disk(&self) -> bool
pub fn is_fsst_buffer_on_disk(&self) -> bool
Check if the FSST buffer is currently stored on disk
Sourcepub fn is_fsst_buffer_in_memory(&self) -> bool
pub fn is_fsst_buffer_in_memory(&self) -> bool
Check if the FSST buffer is currently stored in memory
Trait Implementations§
Source§impl<B: Clone + FsstBuffer> Clone for LiquidByteViewArray<B>
impl<B: Clone + FsstBuffer> Clone for LiquidByteViewArray<B>
Source§impl<B: FsstBuffer> Debug for LiquidByteViewArray<B>
impl<B: FsstBuffer> Debug for LiquidByteViewArray<B>
Source§impl LiquidArray for LiquidByteViewArray<MemoryBuffer>
impl LiquidArray for LiquidByteViewArray<MemoryBuffer>
Source§fn get_array_memory_size(&self) -> usize
fn get_array_memory_size(&self) -> usize
Source§fn to_arrow_array(&self) -> ArrayRef
fn to_arrow_array(&self) -> ArrayRef
Source§fn to_best_arrow_array(&self) -> ArrayRef
fn to_best_arrow_array(&self) -> ArrayRef
Source§fn filter(&self, selection: &BooleanBuffer) -> LiquidArrayRef
fn filter(&self, selection: &BooleanBuffer) -> LiquidArrayRef
Source§fn try_eval_predicate(
&self,
expr: &Arc<dyn PhysicalExpr>,
filter: &BooleanBuffer,
) -> Option<BooleanArray>
fn try_eval_predicate( &self, expr: &Arc<dyn PhysicalExpr>, filter: &BooleanBuffer, ) -> Option<BooleanArray>
None if the predicate is not supported. Read moreSource§fn original_arrow_data_type(&self) -> DataType
fn original_arrow_data_type(&self) -> DataType
Source§fn data_type(&self) -> LiquidDataType
fn data_type(&self) -> LiquidDataType
Source§fn squeeze(&self) -> Option<(LiquidHybridArrayRef, Bytes)>
fn squeeze(&self) -> Option<(LiquidHybridArrayRef, Bytes)>
LiquidHybridArrayRef and a bytes::Bytes.
Return None if the Liquid array cannot be squeezed. Read moreSource§fn filter_to_arrow(&self, selection: &BooleanBuffer) -> ArrayRef
fn filter_to_arrow(&self, selection: &BooleanBuffer) -> ArrayRef
Source§impl LiquidHybridArray for LiquidByteViewArray<DiskBuffer>
impl LiquidHybridArray for LiquidByteViewArray<DiskBuffer>
Source§fn get_array_memory_size(&self) -> usize
fn get_array_memory_size(&self) -> usize
Get the memory size of the Liquid array.
Source§fn to_arrow_array(&self) -> Result<ArrayRef, IoRange>
fn to_arrow_array(&self) -> Result<ArrayRef, IoRange>
Convert the Liquid array to an Arrow array.
Source§fn to_best_arrow_array(&self) -> Result<ArrayRef, IoRange>
fn to_best_arrow_array(&self) -> Result<ArrayRef, IoRange>
Convert the Liquid array to an Arrow array. Except that it will pick the best encoding for the arrow array. Meaning that it may not obey the data type of the original arrow array.
Source§fn data_type(&self) -> LiquidDataType
fn data_type(&self) -> LiquidDataType
Get the logical data type of the Liquid array.
Source§fn filter(
&self,
selection: &BooleanBuffer,
) -> Result<LiquidHybridArrayRef, IoRange>
fn filter( &self, selection: &BooleanBuffer, ) -> Result<LiquidHybridArrayRef, IoRange>
Filter the Liquid array with a boolean buffer.
Source§fn filter_to_arrow(
&self,
selection: &BooleanBuffer,
) -> Result<ArrayRef, IoRange>
fn filter_to_arrow( &self, selection: &BooleanBuffer, ) -> Result<ArrayRef, IoRange>
Filter the Liquid array with a boolean array and return an arrow array.
Source§fn try_eval_predicate(
&self,
expr: &Arc<dyn PhysicalExpr>,
filter: &BooleanBuffer,
) -> Result<Option<BooleanArray>, IoRange>
fn try_eval_predicate( &self, expr: &Arc<dyn PhysicalExpr>, filter: &BooleanBuffer, ) -> Result<Option<BooleanArray>, IoRange>
Try to evaluate a predicate on the Liquid array with a filter.
Returns Ok(None) if the predicate is not supported.
Note that the filter is a boolean buffer, not a boolean array, i.e., filter can’t be nullable. The returned boolean mask is nullable if the the original array is nullable.
Source§fn soak(&self, data: Bytes) -> LiquidArrayRef
fn soak(&self, data: Bytes) -> LiquidArrayRef
Feed IO data to the LiquidHybridArray.
Returns the in-memory LiquidArray.
This is the bridge from hybrid array to in-memory array.
Source§fn original_arrow_data_type(&self) -> DataType
fn original_arrow_data_type(&self) -> DataType
Auto Trait Implementations§
impl<B> Freeze for LiquidByteViewArray<B>where
B: Freeze,
impl<B> RefUnwindSafe for LiquidByteViewArray<B>where
B: RefUnwindSafe,
impl<B> Send for LiquidByteViewArray<B>where
B: Send,
impl<B> Sync for LiquidByteViewArray<B>where
B: Sync,
impl<B> Unpin for LiquidByteViewArray<B>where
B: Unpin,
impl<B> UnsafeUnpin for LiquidByteViewArray<B>where
B: UnsafeUnpin,
impl<B> UnwindSafe for LiquidByteViewArray<B>where
B: UnwindSafe,
Blanket Implementations§
impl<T> Allocation for T
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,
impl<T> ErasedDestructor for Twhere
T: 'static,
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request