alamb commented on code in PR #5170:
URL: https://github.com/apache/opendal/pull/5170#discussion_r1792100250


##########
integrations/parquet/src/async_reader.rs:
##########
@@ -156,40 +156,12 @@ impl AsyncFileReader for AsyncReader {
 
     fn get_metadata(&mut self) -> BoxFuture<'_, 
ParquetResult<std::sync::Arc<ParquetMetaData>>> {
         async move {
-            let prefetched_footer_content = self
-                .inner
-                .read(self.content_length - self.prefetch_footer_size as 
u64..self.content_length)
-                .await
-                .map_err(|err| ParquetError::External(Box::new(err)))?;
-            let prefetched_footer_length = prefetched_footer_content.len();
-
-            // Decode the metadata length from the last 8 bytes of the file.
-            let metadata_length = {
-                let buf = &prefetched_footer_content
-                    .slice((prefetched_footer_length - 
FOOTER_SIZE)..prefetched_footer_length);
-                // Safety: checked above.
-                let buf: [u8; 8] = buf.to_vec().try_into().unwrap();
-                decode_footer(&buf)?
-            };
-
-            // Try to read the metadata from the `prefetched_footer_content`.
-            // Otherwise, fetch exact metadata from the remote.
-            let buf = if prefetched_footer_length >= metadata_length + 
FOOTER_SIZE {
-                prefetched_footer_content.slice(
-                    (prefetched_footer_length - metadata_length - FOOTER_SIZE)
-                        ..(prefetched_footer_length - FOOTER_SIZE),
-                )
-            } else {
-                self.inner
-                    .read(
-                        self.content_length - metadata_length as u64 - 
FOOTER_SIZE as u64
-                            ..self.content_length - FOOTER_SIZE as u64,
-                    )
-                    .await
-                    .map_err(|err| ParquetError::External(Box::new(err)))?
-            };
+            let reader =

Review Comment:
   😍  



-- 
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]

Reply via email to