MCPcopy Create free account
hub / github.com/apache/arrow-rs / decode_block

Method decode_block

arrow-avro/src/reader/mod.rs:887–896  ·  view source on GitHub ↗

Decode either the block count or remaining capacity from `data` (an OCF block payload). Returns the number of bytes consumed from `data` along with the number of records decoded.

(&mut self, data: &[u8], count: usize)

Source from the content-addressed store, hash-verified

885 //
886 // Returns the number of bytes consumed from `data` along with the number of records decoded.
887 fn decode_block(&mut self, data: &[u8], count: usize) -> Result<(usize, usize), AvroError> {
888 // OCF decoding never interleaves records across blocks, so no chunking.
889 let to_decode = std::cmp::min(count, self.remaining_capacity);
890 if to_decode == 0 {
891 return Ok((0, 0));
892 }
893 let consumed = self.active_decoder.decode(data, to_decode)?;
894 self.remaining_capacity -= to_decode;
895 Ok((consumed, to_decode))
896 }
897
898 // Produce a `RecordBatch` if at least one row is fully decoded, returning
899 // `Ok(None)` if no new rows are available.

Callers 2

readMethod · 0.80
read_nextMethod · 0.80

Calls 2

minFunction · 0.85
decodeMethod · 0.45

Tested by

no test coverage detected