Skip to content

core: fix lessThan matching in RoaringTagIndex#1880

Merged
brharrington merged 1 commit intoNetflix:mainfrom
brharrington:lessthan
Feb 28, 2026
Merged

core: fix lessThan matching in RoaringTagIndex#1880
brharrington merged 1 commit intoNetflix:mainfrom
brharrington:lessthan

Conversation

@brharrington
Copy link
Copy Markdown
Contributor

tagOffset returns the insertion point (first element greater than the target) when a tag is not found. The lessThan method iterates backward from this position, but was incorrectly starting at the insertion point itself, which could include values that are not actually less than the query value.

This occurs when the global values array contains values from other keys that cause the computed value position to not exist as a tag for the queried key. For example, nf.asg,a,:lt could incorrectly match "a1javasandbox-v008" because the backward iteration started one position too far forward.

The fix adjusts the starting position when the tag at the insertion point is greater than the target, stepping back to the last element <= the target before iterating.

tagOffset returns the insertion point (first element greater
than the target) when a tag is not found. The lessThan method
iterates backward from this position, but was incorrectly
starting at the insertion point itself, which could include
values that are not actually less than the query value.

This occurs when the global values array contains values from
other keys that cause the computed value position to not exist
as a tag for the queried key. For example, nf.asg,a,:lt could
incorrectly match "a1javasandbox-v008" because the backward
iteration started one position too far forward.

The fix adjusts the starting position when the tag at the
insertion point is greater than the target, stepping back to
the last element <= the target before iterating.
@brharrington brharrington merged commit a0444a7 into Netflix:main Feb 28, 2026
5 checks passed
@brharrington brharrington added this to the 1.9.0 milestone Feb 28, 2026
@brharrington brharrington deleted the lessthan branch February 28, 2026 04:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant