tustvold commented on code in PR #2435:
URL: https://github.com/apache/arrow-rs/pull/2435#discussion_r944581270
##########
parquet/src/arrow/async_reader.rs:
##########
@@ -194,112 +194,23 @@ impl<T: AsyncRead + AsyncSeek + Unpin + Send>
AsyncFileReader for T {
}
}
+#[doc(hidden)]
+/// A newtype used within [`ReaderOptionsBuilder`] to distinguish sync readers
from async
+pub struct AsyncReader<T>(T);
+
/// A builder used to construct a [`ParquetRecordBatchStream`] for a parquet
file
///
/// In particular, this handles reading the parquet file metadata, allowing
consumers
/// to use this information to select what specific columns, row groups, etc...
/// they wish to be read by the resulting stream
///
-pub struct ParquetRecordBatchStreamBuilder<T> {
- input: T,
-
- metadata: Arc<ParquetMetaData>,
-
- schema: SchemaRef,
-
- batch_size: usize,
-
- row_groups: Option<Vec<usize>>,
-
- projection: ProjectionMask,
-
- filter: Option<RowFilter>,
-
- selection: Option<RowSelection>,
-}
+pub type ParquetRecordBatchStreamBuilder<T> =
ArrowReaderBuilder<AsyncReader<T>>;
-impl<T: AsyncFileReader + Send + 'static> ParquetRecordBatchStreamBuilder<T> {
+impl<T: AsyncFileReader + Send + 'static> ArrowReaderBuilder<AsyncReader<T>> {
/// Create a new [`ParquetRecordBatchStreamBuilder`] with the provided
parquet file
pub async fn new(mut input: T) -> Result<Self> {
let metadata = input.get_metadata().await?;
-
- let schema = Arc::new(parquet_to_arrow_schema(
- metadata.file_metadata().schema_descr(),
- metadata.file_metadata().key_value_metadata(),
- )?);
-
- Ok(Self {
- input,
- metadata,
- schema,
- batch_size: 1024,
- row_groups: None,
- projection: ProjectionMask::all(),
- filter: None,
- selection: None,
- })
- }
-
- /// Returns a reference to the [`ParquetMetaData`] for this parquet file
- pub fn metadata(&self) -> &Arc<ParquetMetaData> {
Review Comment:
This logic is moved into ArrowReaderBuilder
--
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]