pub struct SpawnedReader<R> {
inner: R,
handle: Handle,
}Expand description
An AsyncFileReader that performs I/O on a separate tokio runtime.
Tokio is a cooperative scheduler, and relies on tasks yielding in a timely manner to service IO. Therefore, running IO and CPU-bound tasks, such as parquet decoding, on the same tokio runtime can lead to degraded throughput, dropped connections and other issues. For more information see here.
This wrapper spawns each operation of the inner reader onto the provided
runtime [Handle], so that the runtime driving the parquet decoding does
not also drive the I/O.
Note that Self::get_metadata spawns the entire metadata load, so the
footer is also decoded on the provided runtime.
The inner reader must be Clone (typically an Arc’d handle to some
shared resource) as each spawned task requires a 'static copy of it.
Fields§
§inner: R§handle: HandleImplementations§
Source§impl<R> SpawnedReader<R>
impl<R> SpawnedReader<R>
Sourcepub fn new(inner: R, handle: Handle) -> Self
pub fn new(inner: R, handle: Handle) -> Self
Creates a new SpawnedReader that performs the I/O of inner on handle
Sourcepub fn into_inner(self) -> R
pub fn into_inner(self) -> R
Returns the inner reader
Trait Implementations§
Source§impl<R> AsyncFileReader for SpawnedReader<R>
impl<R> AsyncFileReader for SpawnedReader<R>
Source§fn get_bytes(&mut self, range: Range<u64>) -> BoxFuture<'_, Result<Bytes>>
fn get_bytes(&mut self, range: Range<u64>) -> BoxFuture<'_, Result<Bytes>>
rangeSource§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 moreSource§impl<R: Clone> Clone for SpawnedReader<R>
impl<R: Clone> Clone for SpawnedReader<R>
Source§fn clone(&self) -> SpawnedReader<R>
fn clone(&self) -> SpawnedReader<R>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more