pub trait AsyncFileReader: Send {
// Required methods
fn get_bytes(&mut self, range: Range<u64>) -> BoxFuture<'_, Result<Bytes>>;
fn get_metadata<'a>(
&'a mut self,
options: Option<&'a ArrowReaderOptions>,
) -> BoxFuture<'a, Result<Arc<ParquetMetaData>>>;
// Provided method
fn get_byte_ranges(
&mut self,
ranges: Vec<Range<u64>>,
) -> BoxFuture<'_, Result<Vec<Bytes>>> { ... }
}
Expand description
The asynchronous interface used by ParquetRecordBatchStream
to read parquet files
Notes:
-
There is a default implementation for types that implement [
AsyncRead
] and [AsyncSeek
], for exampletokio::fs::File
. -
ParquetObjectReader
, available when theobject_store
crate feature is enabled, implements this interface forObjectStore
.
Required Methods§
Sourcefn get_bytes(&mut self, range: Range<u64>) -> BoxFuture<'_, Result<Bytes>>
fn get_bytes(&mut self, range: Range<u64>) -> BoxFuture<'_, Result<Bytes>>
Retrieve the bytes in range
Sourcefn get_metadata<'a>(
&'a mut self,
options: Option<&'a ArrowReaderOptions>,
) -> BoxFuture<'a, Result<Arc<ParquetMetaData>>>
fn get_metadata<'a>( &'a mut self, options: Option<&'a ArrowReaderOptions>, ) -> BoxFuture<'a, Result<Arc<ParquetMetaData>>>
Return a future which results in the ParquetMetaData
for this Parquet file.
This is an asynchronous operation as it may involve reading the file footer and potentially other metadata from disk or a remote source.
Reading data from Parquet requires the metadata to understand the
schema, row groups, and location of pages within the file. This metadata
is stored primarily in the footer of the Parquet file, and can be read using
ParquetMetaDataReader
.
However, implementations can significantly speed up reading Parquet by supplying cached metadata or pre-fetched metadata via this API.
§Parameters
options
: OptionalArrowReaderOptions
that may contain decryption and other options that affect how the metadata is read.
Provided Methods§
Trait Implementations§
Source§impl AsyncFileReader for Box<dyn AsyncFileReader + '_>
This allows Box<dyn AsyncFileReader + ’_> to be used as an AsyncFileReader,
impl AsyncFileReader for Box<dyn AsyncFileReader + '_>
This allows Box<dyn AsyncFileReader + ’_> to be used as an AsyncFileReader,
Source§fn get_bytes(&mut self, range: Range<u64>) -> BoxFuture<'_, Result<Bytes>>
fn get_bytes(&mut self, range: Range<u64>) -> BoxFuture<'_, Result<Bytes>>
range
Source§fn get_byte_ranges(
&mut self,
ranges: Vec<Range<u64>>,
) -> BoxFuture<'_, Result<Vec<Bytes>>>
fn get_byte_ranges( &mut self, ranges: Vec<Range<u64>>, ) -> BoxFuture<'_, Result<Vec<Bytes>>>
get_bytes
sequentiallySource§fn get_metadata<'a>(
&'a mut self,
options: Option<&'a ArrowReaderOptions>,
) -> BoxFuture<'a, Result<Arc<ParquetMetaData>>>
fn get_metadata<'a>( &'a mut self, options: Option<&'a ArrowReaderOptions>, ) -> BoxFuture<'a, Result<Arc<ParquetMetaData>>>
ParquetMetaData
for this Parquet file. Read moreImplementations on Foreign Types§
Source§impl AsyncFileReader for Box<dyn AsyncFileReader + '_>
This allows Box<dyn AsyncFileReader + ’_> to be used as an AsyncFileReader,
impl AsyncFileReader for Box<dyn AsyncFileReader + '_>
This allows Box<dyn AsyncFileReader + ’_> to be used as an AsyncFileReader,