codeAnqiang-ma opened a new pull request, #10677:
URL: https://github.com/apache/arrow-rs/pull/10677

   # Which issue does this PR close?
   
   - Closes #10676.
   
   # Rationale for this change
   
   With a projection set, `StreamReader` yields batches with the projected 
schema, but `StreamReader::schema()` and its `RecordBatchReader::schema()` impl 
return the full stream schema. Same as #10382 (csv) and #10613 (ipc file 
reader); #10627 fixed `FileReader`, `StreamReader` was the remaining case.
   
   # What changes are included in this PR?
   
   - Keep the projected schema `StreamReader::try_new` already computes as a 
`SchemaRef` and return it from `StreamReader::schema()`; the 
`RecordBatchReader` impl delegates to it, as `FileReader` does.
   - Decoding is untouched: batch and dictionary decoding still use the full 
stream schema, and with no projection the reported schema is unchanged.
   - Add a regression test mirroring 
`test_file_reader_projected_schema_matches_batch_schema`.
   
   # Are these changes tested?
   
   Yes, the new test fails before this change (14 column stream schema vs 3 
column batch schema) and passes after. I ran:
   
   - `cargo test -p arrow-ipc` (143 passed) and `--all-features` (148 passed)
   - `cargo clippy -p arrow-ipc --all-targets --all-features -- -D warnings`
   - `cargo fmt --all -- --check`
   
   I did not run the full workspace suite; outside `arrow-ipc` every 
`StreamReader::try_new` call site passes `None`, which is unaffected.
   
   # Are there any user-facing changes?
   
   Yes. A projected IPC `StreamReader` now reports the same schema as the 
batches it produces. No public API signature changes.
   
   AI assistance: an AI agent found this by auditing the remaining 
`RecordBatchReader` impls after #10613 and drafted the fix and its test; I 
reviewed every line and ran the reproduction and the checks above locally.
   


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