parquet::file::reader

Trait ChunkReader

Source
pub trait ChunkReader:
    Length
    + Send
    + Sync {
    type T: Read;

    // Required methods
    fn get_read(&self, start: u64) -> Result<Self::T>;
    fn get_bytes(&self, start: u64, length: usize) -> Result<Bytes>;
}
Expand description

Generates Readers to read chunks of a Parquet data source.

The Parquet reader uses ChunkReader to access Parquet data, allowing multiple decoders to read concurrently from different locations in the same file.

The trait provides:

§Provided Implementations

  • File for reading from local file system
  • [Bytes] for reading from an in-memory buffer

User provided implementations can implement more sophisticated behaviors such as on-demand buffering or scan sharing.

Required Associated Types§

Source

type T: Read

The concrete type of reader returned by this trait

Required Methods§

Source

fn get_read(&self, start: u64) -> Result<Self::T>

Get a Read instance starting at the provided file offset

Returned readers follow the model of File::try_clone where mutations of one reader affect all readers. Thus subsequent or concurrent calls to Self::get_read or Self::get_bytes may cause side-effects on previously returned readers. Callers of get_read should take care to avoid race conditions.

Source

fn get_bytes(&self, start: u64, length: usize) -> Result<Bytes>

Get a range of data in memory as [Bytes]

Similarly to Self::get_read, this method may have side-effects on previously returned readers.

Implementations on Foreign Types§

Source§

impl ChunkReader for File

Source§

type T = BufReader<File>

Source§

fn get_read(&self, start: u64) -> Result<Self::T>

Source§

fn get_bytes(&self, start: u64, length: usize) -> Result<Bytes>

Source§

impl ChunkReader for Bytes

Source§

type T = Reader<Bytes>

Source§

fn get_read(&self, start: u64) -> Result<Self::T>

Source§

fn get_bytes(&self, start: u64, length: usize) -> Result<Bytes>

Implementors§