Add NullBuffer::try_from_unsliced helper and refactor call sites#9411
Open
Eyad3skr wants to merge 1 commit intoapache:mainfrom
Open
Add NullBuffer::try_from_unsliced helper and refactor call sites#9411Eyad3skr wants to merge 1 commit intoapache:mainfrom
NullBuffer::try_from_unsliced helper and refactor call sites#9411Eyad3skr wants to merge 1 commit intoapache:mainfrom
Conversation
alamb
approved these changes
Feb 13, 2026
Contributor
alamb
left a comment
There was a problem hiding this comment.
Thank you @Eyad3skr -- this looks nice to me
cc @liamzwbao in case you have time to help reivew
| pub fn buffer(&self) -> &Buffer { | ||
| self.buffer.inner() | ||
| } | ||
| /// Create a [`NullBuffer`] from an *unsliced* validity bitmap (`offset = 0`) of length `len`. |
Contributor
There was a problem hiding this comment.
Could you also update this comment to reflect the offset is in bits (not bytes)? Mixing the units is a common mistake so making sure the documentation is as clear as possible would help
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements a helper to replace the pattern of creating a
BooleanBufferfrom an unsliced validity bitmap and filtering by null count. Previously this was done withBooleanBuffer::new(...)plusSome(NullBuffer::new(...)).filter(|n| n.null_count() > 0);now it is a single call toNullBuffer::try_from_unsliced(buffer, len), which returnsSome(NullBuffer)when there are nulls andNonewhen all values are valid.try_from_unslicedinarrow-buffer/src/buffer/null.rswith tests for nulls, all valid, all null, emptyFixedSizeBinaryArray::try_from_iter_with_sizeandtry_from_sparse_iter_with_sizeto use ittake_nullsinarrow-selectto use itCloses #9385