hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lars Francke <lars.fran...@gmail.com>
Subject question about compound keys with two/multiple strings
Date Tue, 24 Nov 2009 17:21:58 GMT
I have another "schema design" question. I hope you don't mind.
My data are key-value pairs (tags on domain elements) with "key" and
"value" being strings. Now I've got a "keys" table with a column
family "values" and the column qualifiers being all the "values" for
this "key".
Everything is fine so far. But now I need a table in which each row
references two key-value pairs (I need to save how often each
combination of key:key, key:key-value and key-value:key-value is used
on my domain elements). So the row key would be a compound key of
key1:value1:key2:value2.

I don't think that is a very good solution as it would only allow me
to easily scan for "key1" (using a PrefixFilter) and I'd have to save
the data redundant to search for "key2" ("key2:value2:key1:value1")
too. Also I'd need to encode the string lengths in the key so that a
Prefix search doesn't accidentally match something from the values. I
searched high and low about how to map such multidimensional data to a
one dimensional model but I couldn't find a good solution.

* I contemplated generating a UUID for every value but that would only
solve part of the problem and I'd have to look that up every time
before I could use it in a Get/Put somewhere
* I could use a hash value of the data but that too doesn't solve the
problem that I'd have hash1:hash2 and hash2:hash1 in the table for
efficient scans and I'd have to make sure that there are no collisions

I hope I'm just not seeing the obvious solution/data structure here
and I hope one of you has an idea - thanks for your continued help and
support.

Cheers,
Lars

Mime
View raw message