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

Provide hashCode, equals for Composites #500

Closed
LannyRipple opened this issue Aug 1, 2012 · 2 comments
Closed

Provide hashCode, equals for Composites #500

LannyRipple opened this issue Aug 1, 2012 · 2 comments

Comments

@LannyRipple
Copy link

Composites, even though a product of value types, do not themselves have value behavior. Provide hashCode() and equals().

Motivating example:

  1. Create column family with composite column-names.
  2. Create template for column family.
  3. Query a slice on the family returning a ColumnFamilyResult.

At this point you cannot specify a new Composite to getColumn() because the implementation uses a Hash and the hashCodes are different for what's in the Hash and what you would hand to getColumn().

@vaidhy
Copy link

vaidhy commented Aug 10, 2012

The problem is that Composites do not know which serializer to use, when de-serializing the data. Check my pull request #503 for one way to handle this.

@LannyRipple
Copy link
Author

Since you are having to hand in a constructed Composite to getColumn() it should know how to create a ByteBuffer of its components. The hashCode could be based on the bytes in the buffer. As a mutable structure though that's gonna turn around and bite pretty quick. I'll have to think on this and see if I can come up with what I'm after.

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

No branches or pull requests

2 participants