Skip to main content

Module row

Module row 

Source
Expand description

Fixed-layout row format for compiled Ring 0 event processing.

EventRow provides a row-oriented, fixed-layout in-memory format that compiled expressions operate on via direct pointer arithmetic. Unlike Arrow’s columnar RecordBatch (optimal for batch processing in Ring 1), EventRow gives compiled Ring 0 pipelines direct pointer access to fields without column indirection.

§Memory Layout

[header: 8 bytes][null_bitmap: padded to 8B][fixed region][variable data region]
  • Header (8 bytes): [field_count: u16][flags: u16][var_region_offset: u32]
  • Null bitmap: ceil(n_fields / 8) bytes, padded to 8-byte alignment
  • Fixed region: Fields in declaration order, naturally aligned
  • Variable data region: Actual bytes for Utf8/Binary fields

§Example

use std::sync::Arc;
use arrow_schema::{DataType, Field, Schema};
use bumpalo::Bump;
use laminar_core::compiler::row::{RowSchema, MutableEventRow};

let schema = Arc::new(Schema::new(vec![
    Field::new("ts", DataType::Int64, false),
    Field::new("value", DataType::Float64, true),
    Field::new("name", DataType::Utf8, true),
]));
let row_schema = RowSchema::from_arrow(&schema).unwrap();

let arena = Bump::new();
let mut row = MutableEventRow::new_in(&arena, &row_schema, 256);
row.set_i64(0, 1_000_000);
row.set_f64(1, 3.14);
row.set_str(2, "hello");

let row = row.freeze();
assert_eq!(row.get_i64(0), 1_000_000);
assert!((row.get_f64(1) - 3.14).abs() < f64::EPSILON);
assert_eq!(row.get_str(2), "hello");

Structs§

EventRow
Zero-copy, read-only accessor for a fixed-layout event row.
FieldLayout
Per-field layout descriptor: absolute byte offset, size, null bitmap position.
MutableEventRow
Arena-allocated, mutable writer for constructing an EventRow.
RowSchema
Pre-computed row layout derived from an Arrow schema.

Enums§

FieldType
Supported scalar types for compiled row access.
RowError
Errors from row schema construction.