Skip to main content

encode_arrow_ipc

Function encode_arrow_ipc 

Source
pub fn encode_arrow_ipc(array: &DoraArray) -> Result<Vec<u8>>
Expand description

Encode an Arrow ArrayData into an Arrow IPC stream byte buffer.

The resulting buffer contains a full IPC stream: schema message, one record batch, and an end-of-stream marker. This is self-describing and can be decoded without external type information.

ยงExample

use dora_node_api::IntoArrow;
use dora_node_api::arrow_utils::{decode_arrow_ipc, encode_arrow_ipc};

let ipc = encode_arrow_ipc(&vec![1u64, 2, 3].into_arrow())?;

// The stream is self-describing: decoding recovers the original data
// without any external type information.
let decoded = decode_arrow_ipc(&ipc)?;
let values: Vec<u64> = (&decoded).try_into()?;
assert_eq!(values, vec![1, 2, 3]);