However, it doesn't show how to get the schema. This would be useful if someone wanted to construct a RecordBatchReader or SendableRecordBatchStream from a stream of Bytes / Buffer. And it would be particularly helpful in cases where there were zero batches but we still wanted to get the schema.
Describe the solution you'd like
Minimally, it would be nice to do this:
impl StreamDecoder {
/// Return the schema, if decoded yet. Returns `None` if the schema message
/// has yet to be decoded.
fn schema(&self) -> Option<SchemaRef> { ... }
}
But it might also be nice to parallel the decode method:
impl StreamDecoder {
/// Return the schema, if decoded yet. Returns `None` if the schema message
/// has yet to be decoded.
fn decode_schema(&mut self, buffer: &mut Buffer) -> Option<SchemaRef> { ... }
}
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
There is a nice example in the
StreamDecoder::decode
docs from reading from a stream:https://docs.rs/arrow-ipc/latest/arrow_ipc/reader/struct.StreamDecoder.html#method.decode
However, it doesn't show how to get the schema. This would be useful if someone wanted to construct a
RecordBatchReader
orSendableRecordBatchStream
from a stream ofBytes
/Buffer
. And it would be particularly helpful in cases where there were zero batches but we still wanted to get the schema.Describe the solution you'd like
Minimally, it would be nice to do this:
But it might also be nice to parallel the decode method:
Describe alternatives you've considered
I asked in Slack if there were other straight forward ways, but didn't see anything easy from the suggestions. https://the-asf.slack.com/archives/C01QUFS30TD/p1726636373388569
Additional context