pub struct Decoder {
record_decoder: RecordDecoder,
batch_size: usize,
decoded_rows: usize,
}
Expand description
A low-level interface for decoding Avro-encoded bytes into Arrow RecordBatch
.
Fields§
§record_decoder: RecordDecoder
§batch_size: usize
§decoded_rows: usize
Implementations§
Source§impl Decoder
impl Decoder
fn new(record_decoder: RecordDecoder, batch_size: usize) -> Self
Sourcepub fn batch_size(&self) -> usize
pub fn batch_size(&self) -> usize
Return the configured maximum number of rows per batch
Sourcepub fn decode(&mut self, data: &[u8]) -> Result<usize, ArrowError>
pub fn decode(&mut self, data: &[u8]) -> Result<usize, ArrowError>
Feed data
into the decoder row by row until we either:
- consume all bytes in
data
, or - reach
batch_size
decoded rows.
Returns the number of bytes consumed.
Sourcepub fn flush(&mut self) -> Result<Option<RecordBatch>, ArrowError>
pub fn flush(&mut self) -> Result<Option<RecordBatch>, ArrowError>
Produce a RecordBatch
if at least one row is fully decoded, returning
Ok(None)
if no new rows are available.
Sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Returns the number of rows that can be added to this decoder before it is full.
Sourcepub fn batch_is_full(&self) -> bool
pub fn batch_is_full(&self) -> bool
Returns true if the decoder has reached its capacity for the current batch.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Decoder
impl RefUnwindSafe for Decoder
impl Send for Decoder
impl Sync for Decoder
impl Unpin for Decoder
impl UnwindSafe for Decoder
Blanket Implementations§
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
Mutably borrows from an owned value. Read more