Skip to content

Commit

Permalink
fix: async reader read miss (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
KKould authored Sep 26, 2024
1 parent 24c7f46 commit 317b1b0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 6 additions & 3 deletions fusio-parquet/src/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ impl AsyncFileReader for AsyncReader {
fn get_bytes(&mut self, range: Range<usize>) -> BoxFuture<'_, parquet::errors::Result<Bytes>> {
async move {
let len = range.end - range.start;
let buf = BytesMut::with_capacity(len);
let mut buf = BytesMut::with_capacity(len);
buf.resize(len, 0);

self.inner
.seek(range.start as u64)
Expand All @@ -65,7 +66,8 @@ impl AsyncFileReader for AsyncReader {
fn get_metadata(&mut self) -> BoxFuture<'_, parquet::errors::Result<Arc<ParquetMetaData>>> {
async move {
let footer_size = self.prefetch_footer_size;
let buf = BytesMut::with_capacity(footer_size);
let mut buf = BytesMut::with_capacity(footer_size);
buf.resize(footer_size, 0);

self.inner
.seek(self.content_length - footer_size as u64)
Expand Down Expand Up @@ -101,7 +103,8 @@ impl AsyncFileReader for AsyncReader {
.await
.map_err(|err| ParquetError::External(Box::new(err)))?;

let buf = BytesMut::with_capacity(metadata_length);
let mut buf = BytesMut::with_capacity(metadata_length);
buf.resize(metadata_length, 0);

let bytes = self
.inner
Expand Down
3 changes: 1 addition & 2 deletions fusio/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ pub mod remotes;

use std::{future::Future, io::Cursor};

pub use buf::IoBuf;
pub use buf::IoBufMut;
pub use buf::{IoBuf, IoBufMut};
#[cfg(all(feature = "dyn", feature = "fs"))]
pub use dynamic::fs::DynFs;
#[cfg(feature = "dyn")]
Expand Down

0 comments on commit 317b1b0

Please sign in to comment.