Xuanwo commented on issue #3725:
URL: 
https://github.com/apache/incubator-opendal/issues/3725#issuecomment-1845267629

   Got it:
   
   
https://github.com/apache/arrow-rs/blob/1534cc196cb5fca09a093fd7886b6d9bfa9831bd/parquet/src/arrow/async_reader/mod.rs#L164-L178
   
   ```rust
   impl<T: AsyncRead + AsyncSeek + Unpin + Send> AsyncFileReader for T {
       fn get_bytes(&mut self, range: Range<usize>) -> BoxFuture<'_, 
Result<Bytes>> {
           async move {
               self.seek(SeekFrom::Start(range.start as u64)).await?;
   
               let to_read = range.end - range.start;
               let mut buffer = Vec::with_capacity(to_read);
               let read = self.take(to_read as u64).read_to_end(&mut 
buffer).await?;
               if read != to_read {
                   return Err(eof_err!("expected to read {} bytes, got {}", 
to_read, read));
               }
   
               Ok(buffer.into())
           }
           .boxed()
       }
   }
   ```
   
   parquet will call `seek` everytime to read a range of file which may lead to 
many read operations on s3 side.


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