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

Modified the implementation of ReadFrom to support roaring 64 to directly read roaring 32 data. #290

Merged
merged 4 commits into from Jan 25, 2021

Conversation

davidchen-cn
Copy link
Contributor

@davidchen-cn davidchen-cn commented Nov 2, 2020

Hi reviewer, I think this can help roaring32 users to smoothly migrate to roaring64.

@lgtm-com
Copy link

lgtm-com bot commented Nov 2, 2020

This pull request introduces 1 alert when merging ed067d5 into 3700649 - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

@coveralls
Copy link

coveralls commented Nov 2, 2020

Coverage Status

Coverage decreased (-0.03%) to 86.955% when pulling a53842b on davidchen-cn:readfrom_roaring32 into 6ec715d on RoaringBitmap:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 82.865% when pulling ed067d5 on davidchen-cn:readfrom_roaring32 into 3700649 on RoaringBitmap:master.

@davidchen-cn davidchen-cn marked this pull request as ready for review November 2, 2020 10:19
@guymolinari
Copy link
Contributor

Good feature. +1

@@ -67,11 +67,11 @@ func (rb *Bitmap) WriteToMsgpack(stream io.Writer) (int64, error) {
// The format is compatible with other RoaringBitmap
// implementations (Java, C) and is documented here:
// https://github.com/RoaringBitmap/RoaringFormatSpec
func (rb *Bitmap) ReadFrom(reader io.Reader) (p int64, err error) {
func (rb *Bitmap) ReadFrom(reader io.Reader, cookieHeader ...byte) (p int64, err error) {
Copy link
Member

Choose a reason for hiding this comment

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

Could you document the new parameter cookieHeader ...byte?

@lgtm-com
Copy link

lgtm-com bot commented Nov 3, 2020

This pull request introduces 1 alert when merging 7498b11 into 3700649 - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

@lemire
Copy link
Member

lemire commented Nov 3, 2020

@guymolinari Would you review it? I just looked at it superficially. It might be useful to have someone think it through.

@guymolinari
Copy link
Contributor

guymolinari commented Nov 3, 2020 via email

@jacksonrnewhouse
Copy link

I have no concerns with the general idea here, but it does seem to ugly-up some methods in ways I'd typically rather avoid. For instance, func (ra *roaringArray) readFrom(stream byteInput, cookieHeader ...byte) (int64, error) is a much uglier method signature than func (ra *roaringArray) readFrom(stream byteInput) (int64, error).

From what I can read, it basically is injecting some values from cookieHeader that would normally be read from the byteInput. How possible would it be to instead factor out all of the reading below the changes, and then have two separate pathways. Something like func (ra *roaringArray) readWithhHeaders(stream byteInput, format formatType) where formatType is a type encompassing the possible headers. That way we could avoid having logic in 32 bit roaring that is just there to support 64 bit roaring.

@guymolinari
Copy link
Contributor

guymolinari commented Nov 3, 2020 via email

@lemire
Copy link
Member

lemire commented Nov 3, 2020

Broadening the scope should be done with care in the sense that we should not ask of a single PR what it cannot provide.

64-bit is a bit of a mess in the sense that there is no cross-language compatibility (at all). You have one implementation in C++, two implementations in Java (both in the RoaringBitmap library), you have one in roaring. People have said good things about the more recent Java 64-bit implementation and it is definitively being used in production.

What one would need to do is to sit down, look and them, and propose a standard format that everyone could agree to. It is not hard as in "curing cancer", but it requires a deliberate effort.

@guymolinari
Copy link
Contributor

guymolinari commented Nov 4, 2020 via email

@lemire
Copy link
Member

lemire commented Nov 23, 2020

@guymolinari Another thoughts regarding this PR? I think we need to either accept it, or make some concrete recommendations to @davidchen-cn I think that @jacksonrnewhouse made some good points about how this PR does make things "uglier" at times. But I think we are a bit too vague about the fix...

@AskAlexSharov
Copy link
Contributor

@guymolinari , hello. do you have any other comments for this PR?
Theoretically can move all "container" types from 32 and 64 packages to "internal" package, but it maybe a big move.

@guymolinari
Copy link
Contributor

guymolinari commented Dec 16, 2020 via email

@lemire
Copy link
Member

lemire commented Dec 16, 2020

@davidchen-cn Would you sync with our main branch? Sorry about this, but it seems that there were changes and the two versions now differ.

@lemire
Copy link
Member

lemire commented Jan 19, 2021

@davidchen-cn Ping! Would you sync your fork?

@davidchen-cn
Copy link
Contributor Author

@lemire Sorry for reply late. I will sync it soon.

@lemire
Copy link
Member

lemire commented Jan 25, 2021

Merging. To be revised later.

@lemire lemire merged commit 4f9df8a into RoaringBitmap:master Jan 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants