Skip to main content

ValuesBuffer

Trait ValuesBuffer 

Source
pub trait ValuesBuffer {
    // Required methods
    fn with_capacity(capacity: usize) -> Self;
    fn pad_nulls(
        &mut self,
        read_offset: usize,
        values_read: usize,
        levels_read: usize,
        valid_mask: &[u8],
    );
}
Expand description

A buffer that supports padding with nulls

Required Methods§

Source

fn with_capacity(capacity: usize) -> Self

Create a new buffer with capacity for at least capacity elements

This allows pre-allocating buffers to avoid reallocations during reading, improving performance when the number of values is known in advance.

Source

fn pad_nulls( &mut self, read_offset: usize, values_read: usize, levels_read: usize, valid_mask: &[u8], )

If a column contains nulls, more level data may be read than value data, as null values are not encoded. Therefore, first the levels data is read, the null count determined, and then the corresponding number of values read to a ValuesBuffer.

It is then necessary to move this values data into positions that correspond to the non-null level positions. This is what this method does.

It is provided with:

  • read_offset - the offset in ValuesBuffer to start null padding from
  • values_read - the number of values read
  • levels_read - the number of levels read
  • valid_mask - a packed mask of valid levels

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T: Copy + Default> ValuesBuffer for Vec<T>

Source§

fn with_capacity(capacity: usize) -> Self

Source§

fn pad_nulls( &mut self, read_offset: usize, values_read: usize, levels_read: usize, valid_mask: &[u8], )

Implementors§

Source§

impl ValuesBuffer for ViewBuffer

Source§

impl<I: OffsetSizeTrait> ValuesBuffer for OffsetBuffer<I>

Source§

impl<K: ArrowNativeType, V: OffsetSizeTrait> ValuesBuffer for DictionaryBuffer<K, V>