Skip to content

Introduce NullBuffer::try_from_unsliced to simplify array construction #9385

@liamzwbao

Description

@liamzwbao

This pattern of creating a BooleanBuffer from with a length and then filtering for nulls count is quite common (and becoming more so)

I wonder if we should (as a follow on PR) make a function to do it, maybe like

let Option<NullBuffer> = NullBuffer::try_from_unsliced(b, array.len())

Then this code would look like

let nulls = array
        .nulls()
        .map(|n| n.inner().sliced())
        .map(|b| NullBuffer::try_from_unsliced(b, array.len()

🤔

Originally posted by @alamb in #9338 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions