alamb commented on code in PR #9753:
URL: https://github.com/apache/arrow-rs/pull/9753#discussion_r3124743701
##########
parquet/src/arrow/async_reader/store.rs:
##########
@@ -186,14 +202,42 @@ impl MetadataSuffixFetch for &mut ParquetObjectReader {
impl AsyncFileReader for ParquetObjectReader {
fn get_bytes(&mut self, range: Range<u64>) -> BoxFuture<'_, Result<Bytes>>
{
- self.spawn(|store, path| store.get_range(path, range).boxed())
+ if self.version.is_some() {
+ let options = self.get_opts(Some(GetRange::from(range)));
+ self.spawn(|store, path| {
+ async move {
+ let resp = store.get_opts(path, options).await?;
+ Ok::<_, ParquetError>(resp.bytes().await?)
+ }
+ .boxed()
Review Comment:
Why do we need the async closure here? Can we simplify this to something
like this
```rust
store.get_opts(path, options).await.boxed()
```
##########
parquet/src/arrow/async_reader/store.rs:
##########
@@ -319,6 +392,21 @@ mod tests {
assert_eq!(batches[0].num_rows(), 8);
}
+ #[tokio::test]
+ async fn test_simple_with_version() {
Review Comment:
How do these very the version is passed through? Do they fail if you revert
the code changes?
##########
parquet/src/arrow/async_reader/store.rs:
##########
@@ -186,14 +202,42 @@ impl MetadataSuffixFetch for &mut ParquetObjectReader {
impl AsyncFileReader for ParquetObjectReader {
fn get_bytes(&mut self, range: Range<u64>) -> BoxFuture<'_, Result<Bytes>>
{
- self.spawn(|store, path| store.get_range(path, range).boxed())
+ if self.version.is_some() {
Review Comment:
Maybe I am missing something but the version is not passed to the options...
So how does it make it into the request?
I also think it would be easier to read this code if you use the same async
closure and just changed the ptions
```rust
let mut options = self.get_opts(Some(GetRange::from(range)));
if let Some(version) = self.version.as_ref() {
options = options.woth_version(version);
}
self.spawn(|store, path| store.get_opts(path, options).boxed())
```
--
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]