Dandandan commented on code in PR #21357:
URL: https://github.com/apache/datafusion/pull/21357#discussion_r3035587687
##########
datafusion/datasource-parquet/src/metadata.rs:
##########
@@ -146,32 +134,69 @@ impl<'a> DFParquetMetadata<'a> {
return Ok(Arc::clone(cached_parquet.parquet_metadata()));
}
- let mut reader =
-
ParquetMetaDataReader::new().with_prefetch_hint(*metadata_size_hint);
+ let file_size = self.object_meta.size;
+ let mut decoder = ParquetMetaDataPushDecoder::try_new(file_size)
+ .map_err(DataFusionError::from)?;
#[cfg(feature = "parquet_encryption")]
- if let Some(decryption_properties) = decryption_properties {
- reader = reader
-
.with_decryption_properties(Some(Arc::clone(decryption_properties)));
+ if let Some(decryption_properties) = &self.decryption_properties {
+ decoder = decoder
+
.with_file_decryption_properties(Some(Arc::clone(decryption_properties)));
}
- if cache_metadata && file_metadata_cache.is_some() {
+ if cache_metadata && self.file_metadata_cache.is_some() {
// Need to retrieve the entire metadata for the caching to be
effective.
- reader = reader.with_page_index_policy(PageIndexPolicy::Optional);
+ decoder =
decoder.with_page_index_policy(PageIndexPolicy::Optional);
+ } else {
+ decoder = decoder.with_page_index_policy(PageIndexPolicy::Skip);
}
- let metadata = Arc::new(
- reader
- .load_and_finish(fetch, object_meta.size)
+ // If we have a size hint, prefetch that many bytes from the end of
the file
Review Comment:
Yeah and we could move these requests out of here (so it could do more
requests in parallel / upfront / separate it from the handling).
I think it could help especially metadata on object store - just buffering
all reads / doing those fully in parallel in one go and just do decoding in cpu
bound threads.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]