Repository navigation
Clamp the end before checking for an empty cardinality range - #600
Merged
Merged
Conversation
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.
Description
CardinalityInRangecan count low IDs when the query lies entirely above the bitmap's 32-bit ID domain. Onmaster, this example returns 3 instead of 0.Type of Change
Changes Made
What was changed?
Cap the exclusive end before testing for an empty range.
Why was it changed?
A start outside the 32-bit domain can wrap to a low ID when cast to
uint32.How was it changed?
Check the adjusted interval before narrowing either endpoint.
Testing
The Go 1.24 package and appengine tests passed. The focused regression passed 30 runs. A sorted-input oracle matched all 5,296 queries with the fix.
Formatting
gofmt -s -landgo tool unconvert ./...passed.Fuzzing
The template's corpus command generated a seed. Go reported
testing: warning: no fuzz tests to fuzzwhen asked to runFuzzSmat.Performance Impact
Six runs of each of nine range-count benchmarks recorded zero allocations on both revisions. Median timings ranged from 9.0% faster to 6.8% slower.
Related Issues
Related to #513.