parquet::arrow::record_reader

Struct GenericRecordReader

Source
pub struct GenericRecordReader<V, CV> {
    column_desc: ColumnDescPtr,
    values: V,
    def_levels: Option<DefinitionLevelBuffer>,
    rep_levels: Option<Vec<i16>>,
    column_reader: Option<GenericColumnReader<RepetitionLevelDecoderImpl, DefinitionLevelBufferDecoder, CV>>,
    num_values: usize,
    num_records: usize,
}
Expand description

A generic stateful column reader that delimits semantic records

This type is hidden from the docs, and relies on private traits with no public implementations. As such this type signature may be changed without breaking downstream users as it can only be constructed through type aliases

Fields§

§column_desc: ColumnDescPtr§values: V§def_levels: Option<DefinitionLevelBuffer>§rep_levels: Option<Vec<i16>>§column_reader: Option<GenericColumnReader<RepetitionLevelDecoderImpl, DefinitionLevelBufferDecoder, CV>>§num_values: usize

Number of buffered levels / null-padded values

§num_records: usize

Number of buffered records

Implementations§

Source§

impl<V, CV> GenericRecordReader<V, CV>
where V: ValuesBuffer, CV: ColumnValueDecoder<Buffer = V>,

Source

pub fn new(desc: ColumnDescPtr) -> Self

Create a new GenericRecordReader

Source

pub fn set_page_reader( &mut self, page_reader: Box<dyn PageReader>, ) -> Result<()>

Set the current page reader.

Source

pub fn read_records(&mut self, num_records: usize) -> Result<usize>

Try to read num_records of column data into internal buffer.

§Returns

Number of actual records read.

Source

pub fn skip_records(&mut self, num_records: usize) -> Result<usize>

Try to skip the next num_records rows

§Returns

Number of records skipped

Source

pub fn num_records(&self) -> usize

Returns number of records stored in buffer.

Source

pub fn num_values(&self) -> usize

Return number of values stored in buffer. If the parquet column is not repeated, it should be equals to num_records, otherwise it should be larger than or equal to num_records.

Source

pub fn consume_def_levels(&mut self) -> Option<Vec<i16>>

Returns definition level data. The implementation has side effects. It will create a new buffer to hold those definition level values that have already been read into memory but not counted as record values, e.g. those from self.num_values to self.values_written.

Source

pub fn consume_rep_levels(&mut self) -> Option<Vec<i16>>

Return repetition level data. The side effect is similar to consume_def_levels.

Source

pub fn consume_record_data(&mut self) -> V

Returns currently stored buffer data. The side effect is similar to consume_def_levels.

Source

pub fn consume_bitmap_buffer(&mut self) -> Option<Buffer>

Returns currently stored null bitmap data for nullable columns. For non-nullable columns, the bitmap is discarded. The side effect is similar to consume_def_levels.

Source

pub fn reset(&mut self)

Reset state of record reader. Should be called after consuming data, e.g. consume_rep_levels, consume_rep_levels, consume_record_data and consume_bitmap_buffer.

Source

pub fn consume_bitmap(&mut self) -> Option<Buffer>

Returns bitmap data for nullable columns. For non-nullable columns, the bitmap is discarded.

Source

fn read_one_batch(&mut self, batch_size: usize) -> Result<usize>

Try to read one batch of data returning the number of records read

Auto Trait Implementations§

§

impl<V, CV> !Freeze for GenericRecordReader<V, CV>

§

impl<V, CV> !RefUnwindSafe for GenericRecordReader<V, CV>

§

impl<V, CV> Send for GenericRecordReader<V, CV>
where V: Send, CV: Send,

§

impl<V, CV> !Sync for GenericRecordReader<V, CV>

§

impl<V, CV> Unpin for GenericRecordReader<V, CV>
where V: Unpin, CV: Unpin,

§

impl<V, CV> !UnwindSafe for GenericRecordReader<V, CV>

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> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T