Skip to content

fix: avoid bitmap range panic on inverted bounds#5893

Merged
wjones127 merged 1 commit intolance-format:mainfrom
fenfeng9:fix/bitmap-inverted-bounds
Feb 5, 2026
Merged

fix: avoid bitmap range panic on inverted bounds#5893
wjones127 merged 1 commit intolance-format:mainfrom
fenfeng9:fix/bitmap-inverted-bounds

Conversation

@fenfeng9
Copy link
Copy Markdown
Contributor

@fenfeng9 fenfeng9 commented Feb 5, 2026

closes #5878

Problem

BITMAP index panics when receiving inverted range queries like BETWEEN 2 AND 1 or x > 2 AND x < 2. This is because BTreeMap::range() panics when start > end or when both bounds are Excluded at the same value.

Solution

Add range validation matching BTREE's existing behavior:

  • [a, b]: empty if a > b
  • [a, b), (a, b], (a, b): empty if a >= b

Returns empty result for empty ranges instead of panicking.

@github-actions github-actions Bot added bug Something isn't working python labels Feb 5, 2026
@fenfeng9
Copy link
Copy Markdown
Contributor Author

fenfeng9 commented Feb 5, 2026

PTAL @wjones127

Copy link
Copy Markdown
Contributor

@wjones127 wjones127 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable. I'm a little surprised those expressions are just simplified to false by the expression optimizer.

@wjones127 wjones127 merged commit aef1490 into lance-format:main Feb 5, 2026
27 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] BITMAP index panic on BETWEEN when low > high

2 participants