pub struct ParquetObjectReader {
store: Arc<dyn ObjectStore>,
meta: ObjectMeta,
metadata_size_hint: Option<usize>,
preload_column_index: bool,
preload_offset_index: bool,
runtime: Option<Handle>,
}
Expand description
Reads Parquet files in object storage using [ObjectStore
].
// Populate configuration from environment
let storage_container = Arc::new(MicrosoftAzureBuilder::from_env().build().unwrap());
let location = Path::from("path/to/blob.parquet");
let meta = storage_container.head(&location).await.unwrap();
println!("Found Blob with {}B at {}", meta.size, meta.location);
// Show Parquet metadata
let reader = ParquetObjectReader::new(storage_container, meta);
let builder = ParquetRecordBatchStreamBuilder::new(reader).await.unwrap();
print_parquet_metadata(&mut stdout(), builder.metadata());
Fields§
§store: Arc<dyn ObjectStore>
§meta: ObjectMeta
§metadata_size_hint: Option<usize>
§preload_column_index: bool
§preload_offset_index: bool
§runtime: Option<Handle>
Implementations§
Source§impl ParquetObjectReader
impl ParquetObjectReader
Sourcepub fn new(store: Arc<dyn ObjectStore>, meta: ObjectMeta) -> Self
pub fn new(store: Arc<dyn ObjectStore>, meta: ObjectMeta) -> Self
Creates a new ParquetObjectReader
for the provided [ObjectStore
] and [ObjectMeta
]
[ObjectMeta
] can be obtained using [ObjectStore::list
] or [ObjectStore::head
]
Provide a hint as to the size of the parquet file’s footer, see fetch_parquet_metadata
Sourcepub fn with_preload_column_index(self, preload_column_index: bool) -> Self
pub fn with_preload_column_index(self, preload_column_index: bool) -> Self
Load the Column Index as part of Self::get_metadata
Sourcepub fn with_preload_offset_index(self, preload_offset_index: bool) -> Self
pub fn with_preload_offset_index(self, preload_offset_index: bool) -> Self
Load the Offset Index as part of Self::get_metadata
Sourcepub fn with_runtime(self, handle: Handle) -> Self
pub fn with_runtime(self, handle: Handle) -> Self
Perform IO on the provided 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.
fn spawn<F, O, E>(&self, f: F) -> BoxFuture<'_, Result<O>>
Trait Implementations§
Source§impl AsyncFileReader for ParquetObjectReader
impl AsyncFileReader for ParquetObjectReader
Source§fn get_bytes(&mut self, range: Range<usize>) -> BoxFuture<'_, Result<Bytes>>
fn get_bytes(&mut self, range: Range<usize>) -> BoxFuture<'_, Result<Bytes>>
Retrieve the bytes in
range
Source§fn get_byte_ranges(
&mut self,
ranges: Vec<Range<usize>>,
) -> BoxFuture<'_, Result<Vec<Bytes>>>where
Self: Send,
fn get_byte_ranges(
&mut self,
ranges: Vec<Range<usize>>,
) -> BoxFuture<'_, Result<Vec<Bytes>>>where
Self: Send,
Retrieve multiple byte ranges. The default implementation will call
get_bytes
sequentiallySource§fn get_metadata(&mut self) -> BoxFuture<'_, Result<Arc<ParquetMetaData>>>
fn get_metadata(&mut self) -> BoxFuture<'_, Result<Arc<ParquetMetaData>>>
Provides asynchronous access to the
ParquetMetaData
of a parquet file,
allowing fine-grained control over how metadata is sourced, in particular allowing
for caching, pre-fetching, catalog metadata, etc…Source§impl Clone for ParquetObjectReader
impl Clone for ParquetObjectReader
Source§fn clone(&self) -> ParquetObjectReader
fn clone(&self) -> ParquetObjectReader
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for ParquetObjectReader
impl !RefUnwindSafe for ParquetObjectReader
impl Send for ParquetObjectReader
impl Sync for ParquetObjectReader
impl Unpin for ParquetObjectReader
impl !UnwindSafe for ParquetObjectReader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more