Skip to main content

RecordDecoder

Struct RecordDecoder 

Source
pub struct RecordDecoder {
    delimiter: Reader,
    num_columns: usize,
    line_number: usize,
    offsets: Vec<usize>,
    offsets_len: usize,
    current_field: usize,
    num_rows: usize,
    data: Vec<u8>,
    data_len: usize,
    truncated_rows: bool,
    truncated_row_count: usize,
}
Expand description

RecordDecoder provides a push-based interface to decoder StringRecords

Fields§

§delimiter: Reader§num_columns: usize

The expected number of fields per row

§line_number: usize

The current line number

§offsets: Vec<usize>

Offsets delimiting field start positions

§offsets_len: usize

The current offset into self.offsets

We track this independently of Vec to avoid re-zeroing memory

§current_field: usize

The number of fields read for the current record

§num_rows: usize

The number of rows buffered

§data: Vec<u8>

Decoded field data

§data_len: usize

Offsets into data

We track this independently of Vec to avoid re-zeroing memory

§truncated_rows: bool

Whether rows with less than expected columns are considered valid

Default value is false When enabled fills in missing columns with null

§truncated_row_count: usize

The number of rows padded because they had fewer fields than expected

Only incremented when truncated_rows is enabled. Cumulative over the lifetime of this decoder, i.e. not reset by Self::flush, but reset by Self::clear along with the buffered rows it counted

Implementations§

Source§

impl RecordDecoder

Source

pub fn new(delimiter: Reader, num_columns: usize, truncated_rows: bool) -> Self

Source

pub fn decode( &mut self, input: &[u8], to_read: usize, ) -> Result<(usize, usize), ArrowError>

Decodes records from input returning the number of records and bytes read

Note: this expects to be called with an empty input to signal EOF

Source

pub fn len(&self) -> usize

Returns the current number of buffered records

Source

pub fn is_empty(&self) -> bool

Returns true if the decoder is empty

Source

pub fn truncated_row_count(&self) -> usize

Returns the number of rows padded because they had fewer fields than expected

Cumulative across Self::flush calls, reset by Self::clear

Source

pub fn clear(&mut self)

Clears the current contents of the decoder

Source

pub fn flush(&mut self) -> Result<StringRecords<'_>, ArrowError>

Flushes the current contents of the reader

Trait Implementations§

Source§

impl Debug for RecordDecoder

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

§

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

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.