Expand description
Arrow RecordBatch → EventRow bridge for Ring 0 input.
BatchRowReader decomposes columnar Arrow data into row-oriented
EventRows allocated in a bump arena. This is the reverse of
RowBatchBridge, which converts
rows back to Arrow RecordBatch.
§Usage
use std::sync::Arc;
use arrow_array::{Int64Array, Float64Array, RecordBatch};
use arrow_schema::{DataType, Field, Schema};
use bumpalo::Bump;
use laminar_core::compiler::row::RowSchema;
use laminar_core::compiler::batch_reader::BatchRowReader;
let schema = Arc::new(Schema::new(vec![
Field::new("ts", DataType::Int64, false),
Field::new("val", DataType::Float64, true),
]));
let batch = RecordBatch::try_new(
Arc::clone(&schema),
vec![
Arc::new(Int64Array::from(vec![1000, 2000])),
Arc::new(Float64Array::from(vec![Some(1.5), None])),
],
).unwrap();
let row_schema = RowSchema::from_arrow(&schema).unwrap();
let reader = BatchRowReader::new(&batch, &row_schema);
assert_eq!(reader.row_count(), 2);
let arena = Bump::new();
let row0 = reader.read_row(0, &arena);
assert_eq!(row0.get_i64(0), 1000);
assert!(!row0.is_null(1));
let row1 = reader.read_row(1, &arena);
assert!(row1.is_null(1));Structs§
- Batch
RowReader - Reads rows from an Arrow [
RecordBatch] intoEventRowformat.