Skip to content

Commit 7ee85b2

Browse files
authored
Use BufReader for LocalFileReader to revert performance regression in parquet reading (#1366)
* Use `BufRead` to improve performance * Undo stat change * Format * Undo stat change * Unneeded imports * Use BufRead in test code * Revert trait change
1 parent 414c826 commit 7ee85b2

File tree

1 file changed

+5
-2
lines changed
  • datafusion/src/datasource/object_store

1 file changed

+5
-2
lines changed

datafusion/src/datasource/object_store/local.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
//! Object store that represents the Local File System.
1919
2020
use std::fs::{self, File, Metadata};
21-
use std::io::{Read, Seek, SeekFrom};
21+
use std::io::{BufReader, Read, Seek, SeekFrom};
2222
use std::sync::Arc;
2323

2424
use async_trait::async_trait;
@@ -87,7 +87,10 @@ impl ObjectReader for LocalFileReader {
8787
// This okay because chunks are usually fairly large.
8888
let mut file = File::open(&self.file.path)?;
8989
file.seek(SeekFrom::Start(start))?;
90-
Ok(Box::new(file.take(length as u64)))
90+
91+
let file = BufReader::new(file.take(length as u64));
92+
93+
Ok(Box::new(file))
9194
}
9295

9396
fn length(&self) -> u64 {

0 commit comments

Comments
 (0)