GH-10676: Fix IPC StreamReader projected schema - #10677
Merged
Jefffrey merged 1 commit intoAug 15, 2026
Merged
Conversation
When a projection is set, StreamReader::schema() returned the full stream schema while the batches it produces carry the projected schema, breaking the RecordBatchReader contract. Return the projected schema that try_new already computes, mirroring the FileReader fix in apache#10627. Assisted-by: Cursor (Opus 5)
Rich-T-kid
approved these changes
Aug 13, 2026
Comment on lines
+1632
to
+1635
| match &self.projection { | ||
| Some((_, projected_schema)) => projected_schema.clone(), | ||
| None => self.schema.clone(), | ||
| } |
Jefffrey
approved these changes
Aug 14, 2026
Contributor
|
thanks @codeAnqiang-ma & @Rich-T-kid |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Rationale for this change
With a projection set,
StreamReaderyields batches with the projected schema, butStreamReader::schema()and itsRecordBatchReader::schema()impl return the full stream schema. Same as #10382 (csv) and #10613 (ipc file reader); #10627 fixedFileReader,StreamReaderwas the remaining case.What changes are included in this PR?
StreamReader::try_newalready computes as aSchemaRefand return it fromStreamReader::schema(); theRecordBatchReaderimpl delegates to it, asFileReaderdoes.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 warningscargo fmt --all -- --checkI did not run the full workspace suite; outside
arrow-ipceveryStreamReader::try_newcall site passesNone, which is unaffected.Are there any user-facing changes?
Yes. A projected IPC
StreamReadernow 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
RecordBatchReaderimpls after #10613 and drafted the fix and its test; I reviewed every line and ran the reproduction and the checks above locally.