parquet::arrow::buffer::offset_buffer

Struct OffsetBuffer

Source
pub struct OffsetBuffer<I: OffsetSizeTrait> {
    pub offsets: Vec<I>,
    pub values: Vec<u8>,
}
Expand description

A buffer of variable-sized byte arrays that can be converted into a corresponding [ArrayRef]

Fields§

§offsets: Vec<I>§values: Vec<u8>

Implementations§

Source§

impl<I: OffsetSizeTrait> OffsetBuffer<I>

Source

pub fn len(&self) -> usize

Returns the number of byte arrays in this buffer

Source

pub fn is_empty(&self) -> bool

Source

pub fn try_push(&mut self, data: &[u8], validate_utf8: bool) -> Result<()>

If validate_utf8 this verifies that the first character of data is the start of a UTF-8 codepoint

Note: This does not verify that the entirety of data is valid UTF-8. This should be done by calling Self::check_valid_utf8 after all data has been written

Source

pub fn extend_from_dictionary<K: ArrowNativeType, V: ArrowNativeType>( &mut self, keys: &[K], dict_offsets: &[V], dict_values: &[u8], ) -> Result<()>

Extends this buffer with a list of keys

For each value key in keys this will insert &dict_values[dict_offsets[key]..dict_offsets[key+1]]

Note: This will validate offsets are valid

Source

pub fn check_valid_utf8(&self, start_offset: usize) -> Result<()>

Validates that &self.values[start_offset..] is a valid UTF-8 sequence

This MUST be combined with validating that the offsets start on a character boundary, otherwise it would be possible for the values array to be a valid UTF-8 sequence, but not the individual string slices it contains

Self::try_push can perform this validation check on insertion

Source

pub fn into_array( self, null_buffer: Option<Buffer>, data_type: ArrowType, ) -> ArrayRef

Converts this into an [ArrayRef] with the provided data_type and null_buffer

Trait Implementations§

Source§

impl<I: Debug + OffsetSizeTrait> Debug for OffsetBuffer<I>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

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

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

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

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. Read more

Auto Trait Implementations§

§

impl<I> Freeze for OffsetBuffer<I>

§

impl<I> RefUnwindSafe for OffsetBuffer<I>
where I: RefUnwindSafe,

§

impl<I> Send for OffsetBuffer<I>

§

impl<I> Sync for OffsetBuffer<I>

§

impl<I> Unpin for OffsetBuffer<I>
where I: Unpin,

§

impl<I> UnwindSafe for OffsetBuffer<I>
where I: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T