-
Notifications
You must be signed in to change notification settings - Fork 8
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
Implement outer join and friends #8
Implement outer join and friends #8
Conversation
Codecov Report
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, thanks for taking it on! The only thing I'm missing is a test that checks that outer_join
indeed returns all the elements of self
before any elements that are exclusively in other
. We promise that in the docs, so we should have a test that the implementation meets that promise.
Thanks for taking a look! :D Yeah, will add that test! However, that's not what I meant when I wrote:
The order I was referring was the the order of the values in the tuple that the iterator yields (i.e. it's |
Ah, I see! Yeah, I think we want to make both promises in the docs (and check in tests) — that the first count in the tuple is from |
The tests for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks!
Published as 0.1.7 🎉 |
This PR implements all of the methods described this comment on #6 :
outer_join
: Takes in a reference to a secondHashBag
and returns an iterator that yields the union of the key sets for bothHashBag
s (ie.keyset(self) ∪ keyset(other)
). Each key is yielded along with its corresponding counts on eachHashBag
.difference
introduced in ImplementHashBag::difference(&self, other: &HashBag)
#6 can be implemented using this functionnot_in
: Takes in a reference to a secondHashBag
and returns an iterator that yields the set difference between the key set of the firstHashBag
and the second one (i.e.keyset(self) \ keyset(other)
). Each key is yielded along with its corresponding count on the firstHashBag
.signed_difference
: Takes in a reference to a secondHashBag
and returns an iterator that yields the union of the keys sets for bothHashBag
s (ie.keyset(self) ∪ keyset(other
). Each key is yielded along with the difference between its count on the first and secondHashBag
s.