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 Read
ers 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 functions both as a reader and a factory for readers.
- random access via
Self::get_bytes
- sequential access via the reader returned via factory method
Self::get_read
§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§
Required Methods§
Sourcefn get_read(&self, start: u64) -> Result<Self::T>
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.