alamb commented on code in PR #10354:
URL: https://github.com/apache/arrow-rs/pull/10354#discussion_r3666456366
##########
parquet/src/arrow/arrow_reader/selection.rs:
##########
@@ -197,7 +200,7 @@ impl RowSelection {
///
/// Note: this method does not make any effort to combine consecutive
ranges, nor coalesce
/// ranges that are close together. This is instead delegated to the IO
subsystem to optimise,
- /// e.g. [`ObjectStore::get_ranges`](object_store::ObjectStore::get_ranges)
+ /// e.g. `ObjectStore::get_ranges` in the `object_store` crate
Review Comment:
perhaps we can link to https://crates.io/crates/object_store
##########
parquet/examples/object_store.rs:
##########
@@ -0,0 +1,168 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use arrow_array::{ArrayRef, Int64Array, RecordBatch};
+use bytes::Bytes;
+use futures::future::BoxFuture;
+use futures::{FutureExt, TryFutureExt, TryStreamExt};
+use object_store::buffered::BufWriter;
+use object_store::memory::InMemory;
+use object_store::path::Path;
+use object_store::{GetOptions, GetRange, ObjectStore, ObjectStoreExt};
+use parquet::arrow::arrow_reader::ArrowReaderOptions;
+use parquet::arrow::async_reader::{AsyncFileReader, MetadataSuffixFetch,
SpawnedReader};
+use parquet::arrow::{AsyncArrowWriter, ParquetRecordBatchStreamBuilder};
+use parquet::errors::{ParquetError, Result};
+use parquet::file::metadata::{ParquetMetaData, ParquetMetaDataReader};
+use std::ops::Range;
+use std::sync::Arc;
+
+/// This example demonstrates reading and writing Parquet files on object
+/// storage via the [`object_store`] crate, without the deprecated
+/// `ParquetObjectReader` and `ParquetObjectWriter` types.
+///
+/// # Example Overview
+///
+/// 1. Writes a Parquet file to an [`ObjectStore`] by passing an
+/// [`object_store::buffered::BufWriter`] directly to [`AsyncArrowWriter`],
+/// via the blanket [`AsyncFileWriter`] implementation for types
+/// implementing [`AsyncWrite`] (replaces `ParquetObjectWriter`).
+///
+/// 2. Reads it back with [`ObjectStoreReader`], a minimal [`AsyncFileReader`]
+/// implementation on top of an [`ObjectStore`] (replaces
Review Comment:
similarly here "equivalent of " ...
##########
parquet/src/arrow/async_reader/mod.rs:
##########
@@ -65,10 +69,94 @@ pub use store::*;
/// 1. There is a default implementation for types that implement [`AsyncRead`]
/// and [`AsyncSeek`], for example [`tokio::fs::File`].
///
-/// 2. [`ParquetObjectReader`], available when the `object_store` crate feature
-/// is enabled, implements this interface for [`ObjectStore`].
+/// 2. Implementations for remote storage, such as the `object_store` crate,
+/// can implement this interface directly, typically by pairing a store
+/// handle with an object path and delegating [`Self::get_bytes`] and
+/// [`Self::get_byte_ranges`] to ranged reads. [`SpawnedReader`] can wrap
Review Comment:
this is great
##########
parquet/examples/object_store.rs:
##########
@@ -0,0 +1,168 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use arrow_array::{ArrayRef, Int64Array, RecordBatch};
+use bytes::Bytes;
+use futures::future::BoxFuture;
+use futures::{FutureExt, TryFutureExt, TryStreamExt};
+use object_store::buffered::BufWriter;
+use object_store::memory::InMemory;
+use object_store::path::Path;
+use object_store::{GetOptions, GetRange, ObjectStore, ObjectStoreExt};
+use parquet::arrow::arrow_reader::ArrowReaderOptions;
+use parquet::arrow::async_reader::{AsyncFileReader, MetadataSuffixFetch,
SpawnedReader};
+use parquet::arrow::{AsyncArrowWriter, ParquetRecordBatchStreamBuilder};
+use parquet::errors::{ParquetError, Result};
+use parquet::file::metadata::{ParquetMetaData, ParquetMetaDataReader};
+use std::ops::Range;
+use std::sync::Arc;
+
+/// This example demonstrates reading and writing Parquet files on object
+/// storage via the [`object_store`] crate, without the deprecated
+/// `ParquetObjectReader` and `ParquetObjectWriter` types.
+///
+/// # Example Overview
+///
+/// 1. Writes a Parquet file to an [`ObjectStore`] by passing an
+/// [`object_store::buffered::BufWriter`] directly to [`AsyncArrowWriter`],
+/// via the blanket [`AsyncFileWriter`] implementation for types
+/// implementing [`AsyncWrite`] (replaces `ParquetObjectWriter`).
Review Comment:
not: maybe we could say "equivalent of `ParquetObjectWriter`" rather than
"replaces"
##########
parquet/examples/object_store.rs:
##########
@@ -0,0 +1,168 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use arrow_array::{ArrayRef, Int64Array, RecordBatch};
+use bytes::Bytes;
+use futures::future::BoxFuture;
+use futures::{FutureExt, TryFutureExt, TryStreamExt};
+use object_store::buffered::BufWriter;
+use object_store::memory::InMemory;
+use object_store::path::Path;
+use object_store::{GetOptions, GetRange, ObjectStore, ObjectStoreExt};
+use parquet::arrow::arrow_reader::ArrowReaderOptions;
+use parquet::arrow::async_reader::{AsyncFileReader, MetadataSuffixFetch,
SpawnedReader};
+use parquet::arrow::{AsyncArrowWriter, ParquetRecordBatchStreamBuilder};
+use parquet::errors::{ParquetError, Result};
+use parquet::file::metadata::{ParquetMetaData, ParquetMetaDataReader};
+use std::ops::Range;
+use std::sync::Arc;
+
+/// This example demonstrates reading and writing Parquet files on object
+/// storage via the [`object_store`] crate, without the deprecated
+/// `ParquetObjectReader` and `ParquetObjectWriter` types.
+///
+/// # Example Overview
+///
+/// 1. Writes a Parquet file to an [`ObjectStore`] by passing an
+/// [`object_store::buffered::BufWriter`] directly to [`AsyncArrowWriter`],
+/// via the blanket [`AsyncFileWriter`] implementation for types
+/// implementing [`AsyncWrite`] (replaces `ParquetObjectWriter`).
+///
+/// 2. Reads it back with [`ObjectStoreReader`], a minimal [`AsyncFileReader`]
+/// implementation on top of an [`ObjectStore`] (replaces
+/// `ParquetObjectReader`).
+///
+/// 3. Reads it again with the reader wrapped in a [`SpawnedReader`], which
+/// performs all I/O on a separate tokio runtime so that the runtime
+/// decoding Parquet is not also driving the I/O (replaces
Review Comment:
and here
##########
parquet/src/arrow/async_writer/store.rs:
##########
@@ -68,11 +72,19 @@ use tokio::io::AsyncWriteExt;
/// assert_eq!(to_write, read);
/// # }
/// ```
+///
+/// [`AsyncWrite`]: tokio::io::AsyncWrite
+/// [`AsyncArrowWriter`]: crate::arrow::async_writer::AsyncArrowWriter
+#[deprecated(
+ since = "59.2.0",
+ note = "Pass an `object_store::buffered::BufWriter` to `AsyncArrowWriter`
directly instead; see `parquet/examples/object_store.rs`"
Review Comment:
I double checked that this is the right suggestion
https://docs.rs/object_store/latest/object_store/buffered/struct.BufWriter.html
--
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]