(self)
| 179 | } |
| 180 | |
| 181 | pub(crate) fn build(self) -> DataRequest { |
| 182 | let Self { |
| 183 | row_group_idx, |
| 184 | row_count, |
| 185 | batch_size, |
| 186 | parquet_metadata, |
| 187 | projection, |
| 188 | selection, |
| 189 | cache_projection, |
| 190 | column_chunks, |
| 191 | } = self; |
| 192 | |
| 193 | let row_group_meta_data = parquet_metadata.row_group(row_group_idx); |
| 194 | |
| 195 | // If no previously read column chunks are provided, create a new location to hold them |
| 196 | let column_chunks = |
| 197 | column_chunks.unwrap_or_else(|| vec![None; row_group_meta_data.columns().len()]); |
| 198 | |
| 199 | // Create an InMemoryRowGroup to hold the column chunks, this is a |
| 200 | // temporary structure used to tell the ArrowReaders what pages are |
| 201 | // needed for decoding |
| 202 | let row_group = InMemoryRowGroup { |
| 203 | row_count, |
| 204 | column_chunks, |
| 205 | offset_index: get_offset_index(parquet_metadata, row_group_idx), |
| 206 | row_group_idx, |
| 207 | metadata: parquet_metadata, |
| 208 | }; |
| 209 | |
| 210 | let FetchRanges { |
| 211 | ranges, |
| 212 | page_start_offsets, |
| 213 | } = row_group.fetch_ranges(projection, selection, batch_size, cache_projection); |
| 214 | |
| 215 | DataRequest { |
| 216 | // Save any previously read column chunks |
| 217 | column_chunks: row_group.column_chunks, |
| 218 | ranges, |
| 219 | page_start_offsets, |
| 220 | } |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | fn get_offset_index( |
no test coverage detected