tustvold commented on code in PR #3550:
URL: https://github.com/apache/arrow-rs/pull/3550#discussion_r1073406262


##########
parquet/src/arrow/async_reader/mod.rs:
##########
@@ -199,10 +199,11 @@ impl<T: AsyncRead + AsyncSeek + Unpin + Send> 
AsyncFileReader for T {
             self.seek(SeekFrom::End(-FOOTER_SIZE_I64 - metadata_len as i64))
                 .await?;
 
-            let mut buf = Vec::with_capacity(metadata_len);
-            self.read_to_end(&mut buf).await?;
+            let mut buf_meta = vec![0_u8; metadata_len];
+            self.read_exact(buf_meta.as_mut_slice()).await?;
+            buf_meta.extend(buf);

Review Comment:
   ```suggestion
               let mut buf_meta = Vec::with_capacity(metadata_len);
               self.take(metadata_len as _).read_to_end(&mut buf).await?;
   ```



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to