Module arrow

Module arrow 

Source
Expand description

Apache Arrow memory layout integration for zero-copy tensor access.

This module provides conversions between IPFRS tensor types and Apache Arrow arrays, enabling zero-copy interoperability with the Arrow ecosystem (Parquet, Flight, etc.).

§Example

use ipfrs_core::arrow::{TensorBlockArrowExt, arrow_to_tensor_block};
use ipfrs_core::tensor::{TensorBlock, TensorDtype, TensorShape};
use bytes::Bytes;
use arrow_array::Float32Array;

// Convert Arrow array to TensorBlock (zero-copy)
let arrow_array = Float32Array::from(vec![1.0f32, 2.0, 3.0, 4.0]);
let tensor = arrow_to_tensor_block(&arrow_array, TensorShape::new(vec![2, 2])).unwrap();

// Convert TensorBlock back to Arrow array
let arrow_back = tensor.to_arrow_array().unwrap();

Traits§

TensorBlockArrowExt
Extension trait for TensorBlock to provide Arrow conversions

Functions§

arrow_dtype_to_tensor
Convert Arrow DataType to TensorDtype
arrow_to_tensor_block
Convert an Arrow array to a TensorBlock (zero-copy)
tensor_dtype_to_arrow
Convert TensorDtype to Arrow DataType
tensors_to_record_batch
Create an Arrow RecordBatch from multiple TensorBlocks