alamb commented on code in PR #7997: URL: https://github.com/apache/arrow-rs/pull/7997#discussion_r2445873967
########## parquet/src/arrow/in_memory_row_group.rs: ########## @@ -0,0 +1,296 @@ +// 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 crate::arrow::ProjectionMask; +use crate::arrow::array_reader::RowGroups; +use crate::arrow::arrow_reader::RowSelection; +use crate::column::page::{PageIterator, PageReader}; +use crate::errors::ParquetError; +use crate::file::metadata::ParquetMetaData; +use crate::file::page_index::offset_index::OffsetIndexMetaData; +use crate::file::reader::{ChunkReader, Length, SerializedPageReader}; +use bytes::{Buf, Bytes}; +use std::ops::Range; +use std::sync::Arc; + +/// An in-memory collection of column chunks +#[derive(Debug)] +pub(crate) struct InMemoryRowGroup<'a> { + pub(crate) offset_index: Option<&'a [OffsetIndexMetaData]>, + /// Column chunks for this row group + pub(crate) column_chunks: Vec<Option<Arc<ColumnChunkData>>>, + pub(crate) row_count: usize, + pub(crate) row_group_idx: usize, + pub(crate) metadata: &'a ParquetMetaData, +} + +/// What ranges to fetch for the columns in this row group +#[derive(Debug)] +pub(crate) struct FetchRanges { + /// The byte ranges to fetch + pub(crate) ranges: Vec<Range<u64>>, + /// If `Some`, the start offsets of each page for each column chunk + pub(crate) page_start_offsets: Option<Vec<Vec<u64>>>, +} + +impl InMemoryRowGroup<'_> { + /// Returns the byte ranges to fetch for the columns specified in + /// `projection` and `selection`. + pub(crate) fn fetch_ranges( Review Comment: > Came here looking to confirm this. It looks like you've taken one big async fn fetch and split it up into multiple smaller pub(crate) fn fetch_ranges and pub(crate) fn fill_column_chunks which seems reasonable to me. No new public APIs. Smaller functions. 👍🏻 Yes that is exactly right -- previously the state machine was implicit (created by the rust compiler when hitting `await`) -- 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]
