Skip to content

fix: Count validity bits only up to the column length - #222

Open
SamuelSchlesinger wants to merge 2 commits into
DataHaskell:mainfrom
SamuelSchlesinger:fix/bitmap-slice-padding
Open

fix: Count validity bits only up to the column length#222
SamuelSchlesinger wants to merge 2 commits into
DataHaskell:mainfrom
SamuelSchlesinger:fix/bitmap-slice-padding

Conversation

@SamuelSchlesinger

Copy link
Copy Markdown

bitmapSlice keeps whole bytes on its aligned path, so the trailing bits of a sliced bitmap still describe rows outside the slice. numElements and allMissing folded the whole byte vector, so summarize after take/range over-counted non-null rows and an all-null slice could read as not-all-null.

Add popCountUpTo to the Bitmap module and stop at the column length.

bitmapSlice's byte-aligned path returns whole bytes, so the last byte of
a slice still carries validity bits for rows past the end of the slice.
numElements and allMissing fold popCount over the whole byte vector and
count them, so summarize reports Count 8 for a three-row take and for a
five-row range, and an all-null slice no longer reads as all-null.
numElements and allMissing folded over the whole byte vector, so they
counted the trailing bits a byte-aligned bitmapSlice leaves describing
rows outside the slice. Add popCountUpTo and pass the column length,
which keeps the aligned slice O(1) rather than copying to mask the last
byte.
@SamuelSchlesinger
SamuelSchlesinger force-pushed the fix/bitmap-slice-padding branch from 818cf21 to 1b40494 Compare August 24, 2026 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant