hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Latham <lat...@davelink.net>
Subject Re: question about compound keys with two/multiple strings
Date Wed, 25 Nov 2009 17:02:08 GMT
I'm not sure I understand your requirements entirely, but there are order
insensitive functions you can use to generate a key for any pair of
elements.  Any commutative operation on the two keys would work, but if you
use a hash you need to worry about collisions.  If you take your two (or
more) keys, and sort them, then concatenate them, you will have a simple
compound key that will always be the same regardless of the original order
of your values.  If that's all you need, then you only need one row per
combination of keys, and you can look up or store quickly given a set
combination.

>From your original note it sounded like you may need to be able to look up
all the combinations that include a partial key.  In that case, you will
have to store duplicate information for quick lookups.

Dave

On Tue, Nov 24, 2009 at 5:32 PM, Lars Francke <lars.francke@gmail.com>wrote:

> > If you need to be able to scan/lookup based on two different key/values,
> > then you will most likely need duplicate tables or duplicate rows.
> >
> > This is common when you need to support two different lookup/read
> patterns.
>
> Thanks for the answer. I had hoped there was some kind of (order
> insensitive) hash function for multidimensional data that generates
> the same hash regardless of the order of elements but I've worked my
> way through a fair share of papers without finding something. I had
> just hoped I was missing the obvious.
>
> Lars
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message