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

Fix JoinKey sort order and allow comparison with other types. #72

Merged
merged 1 commit into from Sep 4, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions dumbo/backends/common.py
Expand Up @@ -93,11 +93,11 @@ def __init__(self, body, isprimary=False):
self.isprimary = isprimary

def __cmp__(self, other):
bodycmp = cmp(self.body, other.body)
if bodycmp:
return bodycmp
if isinstance(other, JoinKey):
# For isprimary, order is switched because we want True to sort before False
return cmp(self.body, other.body) or cmp(other.isprimary, self.isprimary)
else:
return cmp(self.isprimary, other.isprimary)
return -1 # JoinKeys arbitrarily come before everything else

@classmethod
def fromjoinkey(cls, jk):
Expand Down