perf(arrow/array): compare optional validity bitmaps in bulk - #1327
Open
fallintoplace wants to merge 3 commits into
Open
fallintoplace wants to merge 3 commits into
fallintoplace wants to merge 3 commits into
Conversation
zeroshade
reviewed
Sep 20, 2026
zeroshade
left a comment
Member
There was a problem hiding this comment.
Non-blocking malformed-input edge case: BitmapAllSet([]byte{0xff}, 64, 0) panics. With n == 0, both loops are skipped, but the word-scan still evaluates buf[8:8], which is out of bounds for a one-byte slice. This also changes equality for a zero-length hand-built ArrayData with an out-of-buffer offset from vacuously true to panic. Normal validated arrays cannot reach it. An early if n == 0 { return true } preserves the expected empty-range contract.
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.
What
EqualandApproxEqualwhen one array has no validity bitmap.Why
Implementation
BitmapAllSeton the present bitmap, scanning aligned words and respecting its slice offset.Benchmark
Command:
go test -run '^$' -bench '^BenchmarkArrayEqualValidityBitmap$' -benchmem ./arrow/arrayApple M1 Pro, Go 1.26.3,
GOMAXPROCS=1. Medians of six alternating before/after runs, 300 ms per case. Each case compares 1,048,576 values with one absent bitmap and one materialized bitmap. Binary/string values are 8 bytes each.No new allocations. The benchmark also covers 64-value arrays, unaligned slices, and controls with both bitmaps present or both absent.
Compatibility
Tests
go test ./arrow/...go test -race ./arrow/arraygo test -tags noasm ./arrow/arraygo vet -composites=false ./arrow/array