polars_arrow::ffi::mmap

Function bitmap

Source
pub unsafe fn bitmap(
    data: &[u8],
    offset: usize,
    length: usize,
) -> 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

Using this function is not unsafe, but the returned BooleanArrays’s lifetime is bound to the lifetime of the slice. The returned BooleanArray must not outlive the passed slice.