Xuanwo commented on code in PR #364:
URL: https://github.com/apache/iceberg-rust/pull/364#discussion_r1596403546


##########
crates/iceberg/src/arrow/reader.rs:
##########
@@ -187,3 +197,43 @@ impl ArrowReader {
         }
     }
 }
+
+/// ArrowFileReader is a wrapper around a FileRead that impls parquets 
AsyncFileReader.
+///
+/// # TODO
+///
+/// 
[ParquetObjectReader](https://docs.rs/parquet/latest/src/parquet/arrow/async_reader/store.rs.html#64)
 contains the following hints to speed up metadata loading, we can consider 
adding them to this struct:
+///
+/// - `metadata_size_hint`: Provide a hint as to the size of the parquet 
file's footer.
+/// - `preload_column_index`: Load the Column Index  as part of 
[`Self::get_metadata`].
+/// - `preload_offset_index`: Load the Offset Index as part of 
[`Self::get_metadata`].
+struct ArrowFileReader<R: FileRead> {
+    meta: FileMetadata,
+    r: R,
+}
+
+impl<R: FileRead> ArrowFileReader<R> {
+    /// Create a new ArrowFileReader
+    fn new(meta: FileMetadata, r: R) -> Self {
+        Self { meta, r }
+    }
+}
+
+impl<R: FileRead> AsyncFileReader for ArrowFileReader<R> {
+    fn get_bytes(&mut self, range: Range<usize>) -> BoxFuture<'_, 
parquet::errors::Result<Bytes>> {
+        Box::pin(
+            self.r
+                .read(range.start as _..range.end as _)

Review Comment:
   Reader accepts `Range<u64>` but traits requires `Range<usize>`. And sadly, I 
don't know better ways to cast them.



-- 
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: issues-unsubscr...@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to