polars_arrow::ffi::mmap

Function bitmap_and_owner

Source
pub unsafe fn bitmap_and_owner<O>(
    data: &[u8],
    offset: usize,
    length: usize,
    owner: O,
) -> PolarsResult<BooleanArray>
Expand description

Creates a (non-null) BooleanArray from a slice of bits. This does not have memcopy and is the fastest way to create a BooleanArray.

This can be useful if you want to apply arrow kernels on slices without incurring a memcopy cost.

The offset indicates where the first bit starts in the first byte.

ยงSafety

The caller must ensure the passed owner ensures the data remains alive.