Skip to main content

decode_batch

Function decode_batch 

Source
pub fn decode_batch(bytes: &[u8]) -> Result<Option<RecordBatch>, IpcError>
Expand description

Decode the single RecordBatch from Arrow IPC stream bytes.

encode_batch writes exactly one batch, so any well-formed stream from this codec carries one batch (or zero, when the plugin produced no rows). Multiple batches indicate a malformed or malicious sender and are rejected.

Returns None if the stream contained only an end-of-stream marker.

§Errors

Returns IpcError::Arrow if the bytes are malformed or if the stream contains more than one batch. The previous form used Vec::pop() and silently returned the last batch when more than one was present, contradicting the “first batch” contract its documentation promised.