Skip to main content

Crate vortex_bytebool

Crate vortex_bytebool 

Source
Expand description

A Vortex encoding that mirrors Arrow’s 8-bit Boolean canonical extension type.

Each element is stored as a single byte. The zero byte represents false and any non-zero byte represents true, matching the truthy semantics of the Arrow spec. This trades 8x the storage of the bit-packed Bool layout for cheaper per-byte access — useful when data arrives from a C ABI or other source that already emits byte-wide booleans. On execution the array materializes into the standard bit-packed BoolArray.

§Examples

Any non-zero byte in the backing buffer is treated as true when the array executes to a canonical BoolArray:

let handle = BufferHandle::new_host(ByteBuffer::from(vec![0u8, 1, 42, 0]));
let array = ByteBool::new(handle, Validity::NonNullable);

let bits = array.into_array().execute::<BoolArray>(&mut ctx)?.to_bit_buffer();
assert!(!bits.value(0));
assert!(bits.value(1));
assert!(bits.value(2)); // byte 42 is truthy
assert!(!bits.value(3));

Structs§

ByteBool
ByteBoolData

Traits§

ByteBoolArrayExt

Type Aliases§

ByteBoolArray
A ByteBool-encoded Vortex array.