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

Modify the from_sorted_iter and append methods to return a Result #106

Merged
merged 5 commits into from Oct 21, 2021

Conversation

Kerollmops
Copy link
Member

@Kerollmops Kerollmops commented May 25, 2021

This PR fixes #103, which means that the from_sorted_iter and append methods of the RoaringBit/Treemap types now return a Result. The Err value corresponds to the number of values that we appended to the set until we found an erroneous value, it eases debugging.

These two methods were containing bugs in the sense that they were silently discarding invalid values instead of panicking, this bug was introduced by #99 which introduced a non-panicking push method.

A possible improvement could be to introduce a new error type, something like a NonSortedIntegers struct with a stopped_at/valid_until method that returns the u64 we currently return as the Err.

@MarinPostma could you please take a look at this PR? If you got the time?

@Kerollmops Kerollmops added the breaking This change will require a bump of the minor or major version. label May 25, 2021
@Kerollmops
Copy link
Member Author

bors try

bors bot added a commit that referenced this pull request May 25, 2021
@bors
Copy link
Contributor

bors bot commented May 25, 2021

try

Build succeeded:

Copy link
Contributor

@MarinPostma MarinPostma left a comment

Choose a reason for hiding this comment

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

sorry for the late review. LGTM modulo doc edits :)

src/bitmap/iter.rs Outdated Show resolved Hide resolved
src/bitmap/iter.rs Outdated Show resolved Hide resolved
src/bitmap/iter.rs Outdated Show resolved Hide resolved
src/bitmap/iter.rs Outdated Show resolved Hide resolved
src/bitmap/iter.rs Outdated Show resolved Hide resolved
src/treemap/iter.rs Outdated Show resolved Hide resolved
src/treemap/iter.rs Outdated Show resolved Hide resolved
src/treemap/iter.rs Outdated Show resolved Hide resolved
src/treemap/iter.rs Outdated Show resolved Hide resolved
@Kerollmops Kerollmops force-pushed the failible-from-sorted-iter branch 2 times, most recently from c04ac3d to b4e03f5 Compare June 1, 2021 09:02
@Kerollmops
Copy link
Member Author

bors try

@bors
Copy link
Contributor

bors bot commented Jun 1, 2021

try

Merge conflict.

@Kerollmops
Copy link
Member Author

bors try

bors bot added a commit that referenced this pull request Jun 1, 2021
@bors
Copy link
Contributor

bors bot commented Jun 1, 2021

try

Build failed:

@Kerollmops
Copy link
Member Author

bors try

bors bot added a commit that referenced this pull request Jun 1, 2021
@bors
Copy link
Contributor

bors bot commented Jun 1, 2021

try

Build succeeded:

@Kerollmops
Copy link
Member Author

bors merge

@bors
Copy link
Contributor

bors bot commented Oct 21, 2021

Merge conflict.

@Kerollmops
Copy link
Member Author

bors merge

@bors
Copy link
Contributor

bors bot commented Oct 21, 2021

Build succeeded:

@bors bors bot merged commit e0d6477 into master Oct 21, 2021
@bors bors bot deleted the failible-from-sorted-iter branch October 21, 2021 13:20
not-jan pushed a commit to not-jan/roaring-rs that referenced this pull request Aug 31, 2022
106: Modify the from_sorted_iter and append methods to return a Result r=Kerollmops a=Kerollmops

This PR fixes RoaringBitmap#103, which means that the `from_sorted_iter` and `append` methods of the `RoaringBit/Treemap` types now return a `Result`. The `Err` value corresponds to the number of values that we appended to the set until we found an erroneous value, it eases debugging.

These two methods were containing bugs in the sense that they were silently discarding invalid values instead of panicking, this bug was introduced by RoaringBitmap#99 which introduced a non-panicking push method.

A possible improvement could be to introduce a new error type, something like a `NonSortedIntegers` struct with a `stopped_at`/`valid_until` method that returns the `u64` we currently return as the `Err`.

`@MarinPostma` could you please take a look at this PR? If you got the time?

Co-authored-by: Kerollmops <clement@meilisearch.com>
Co-authored-by: Clément Renault <renault.cle@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking This change will require a bump of the minor or major version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update the from_sorter_iter method to return an option
2 participants