adriangb opened a new pull request, #11393:
URL: https://github.com/apache/arrow-rs/pull/11393

   # Which issue does this PR close?
   
   - Follow-up to https://github.com/apache/arrow-rs/pull/11330, for [this 
review 
comment](https://github.com/apache/arrow-rs/pull/11330#discussion_r4189970839).
   
   # Rationale for this change
   
   `RowGroupReaderBuilder::new` made a placeholder `StageSchedule`, then 
replaced it a few lines down:
   
   ```rust
   let mut builder = Self {
       // ...
       stages: StageSchedule::new(ProjectionMask::all(), vec![], None),
   };
   // ... compute the projections with 
`builder.compute_cache_projection_inner(filter)` ...
   builder.stages = StageSchedule::new(/* the real values */);
   builder
   ```
   
   The placeholder was necessary because `compute_cache_projection_inner` was a 
`&self` method, so the builder had to exist before the schedule could be 
computed.
   
   The placeholder did not allocate on the heap: `ProjectionMask::all()` holds 
`None` and `vec![]` is an empty `Vec`. But it was a value that was built only 
to be discarded, and a reader had to check that it was never used.
   
   # What changes are included in this PR?
   
   - `compute_cache_projection_inner` becomes an associated function. It takes 
the filter, the projection, the metadata and the predicate cache size as 
arguments.
   - `RowGroupReaderBuilder::new` computes the `StageSchedule` first, then 
builds the struct one time. The `let mut builder` and the placeholder are gone.
   - `exclude_nested_columns_from_cache` had one caller and one line. It is now 
inline in `compute_cache_projection_inner`.
   
   There is no behavior change.
   
   # Are these changes tested?
   
   Yes, by the existing tests. These pass locally:
   
   - `cargo test -p parquet --all-features --lib -- push_decoder arrow:: 
async_reader` (555 tests)
   - `cargo test -p parquet --all-features --test arrow_reader` (150 tests)
   - `cargo clippy -p parquet --all-features --all-targets -- -D warnings`
   
   # Are there any user-facing changes?
   
   No. All changed items are private.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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]

Reply via email to