This is an automated email from the ASF dual-hosted git repository.

dheres pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git


The following commit(s) were added to refs/heads/master by this push:
     new 7ee85b2  Use `BufReader` for LocalFileReader to revert performance 
regression in parquet reading (#1366)
7ee85b2 is described below

commit 7ee85b26e101fa7583bf2aeb50cfd3f58d226dd3
Author: DaniĆ«l Heres <[email protected]>
AuthorDate: Sat Nov 27 15:36:16 2021 +0100

    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
---
 datafusion/src/datasource/object_store/local.rs | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/datafusion/src/datasource/object_store/local.rs 
b/datafusion/src/datasource/object_store/local.rs
index b2a2ddf..0e857c8 100644
--- a/datafusion/src/datasource/object_store/local.rs
+++ b/datafusion/src/datasource/object_store/local.rs
@@ -18,7 +18,7 @@
 //! Object store that represents the Local File System.
 
 use std::fs::{self, File, Metadata};
-use std::io::{Read, Seek, SeekFrom};
+use std::io::{BufReader, Read, Seek, SeekFrom};
 use std::sync::Arc;
 
 use async_trait::async_trait;
@@ -87,7 +87,10 @@ impl ObjectReader for LocalFileReader {
         // This okay because chunks are usually fairly large.
         let mut file = File::open(&self.file.path)?;
         file.seek(SeekFrom::Start(start))?;
-        Ok(Box::new(file.take(length as u64)))
+
+        let file = BufReader::new(file.take(length as u64));
+
+        Ok(Box::new(file))
     }
 
     fn length(&self) -> u64 {

Reply via email to