Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intersection is empty when it should not be #30

Closed
skatenerd opened this issue Oct 10, 2023 · 3 comments · Fixed by #33 or #42
Closed

Intersection is empty when it should not be #30

skatenerd opened this issue Oct 10, 2023 · 3 comments · Fixed by #33 or #42

Comments

@skatenerd
Copy link

If we call:
MultiRange.new([10..10]) & MultiRange.new([10..20])

We should get a nonempty range. But I am seeing an empty range instead. Interestingly, the behavior is not commutative. If I flip the two arguments, I get a nonempty range.

@skatenerd
Copy link
Author

skatenerd commented Oct 10, 2023

I wonder if the fix is as simple as this?

https://github.com/greensync/interval-tree/blob/3b412ce1f1338fcbefe0f0779d65635d0280840e/lib/interval_tree.rb#L136

Kinda unfortunate that the bug lives in an unmaintained repo

image

We could also just, internally, convert the query from 10..10 to 10, the search function is happier with this and gives the right answer, since it falls back to point_search

@khiav223577
Copy link
Owner

Thanks for the report. I submitted an issue to fast_interval_tree: greensync/interval-tree#17
And add a workaround for the issue in #33

@khiav223577
Copy link
Owner

Just release v2.2.0, See the changelog for more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants