Lukáš Drbal 2013-03-04, 10:48
Jilal Oussama 2013-03-04, 11:01
Lukáš Drbal 2013-03-04, 20:55
Ted Yu 2013-03-04, 21:06
Lukáš Drbal 2013-03-04, 21:27
Ted Yu 2013-03-04, 21:32
-Re: Rowkey design and presplit table
Asaf Mesika 2013-03-07, 07:42
I would convert each id to long and then use Bytes.toBytes to convert this
long to a byte array. If it is an int then even better.
Now, write all 3 longs one after another to one array which will be your
This gives you:
* fixed size
* small row key - 3*8 bytes if you use long and 3*4 for int.
Why do you need to use prefix split policy?
On Monday, March 4, 2013, Lukáš Drbal wrote:
> i have one question about rowkey design and presplit table.
> My usecase:
> I need store a lot of comments where each comment are for one article and
> this article has one category.
> What i need:
> 1) read one comment by id (where i know commentId, articleId and
> 2) read all coments for article (i know categoryId and articleId)
> 3) read all comments for category (i know categoryId)
> From this read pattern i see one good rowkey:
> But here i don't have fixed size of rowkey, so i don't know how to define
> split pattern. How can be this solved?
> This id's come from external system and grow very fast, so add some like
> "padding" for each part are hard.
> Maybe i can use hash function for each part
> md5(<categoryId>_md5(<articleId>)_md5(<commentId>), but this rowkey is very
> long (3*32+2 bytes), i don't have experience with this long rowkeys.
> Can someone give me a suggestions please?
> Lukas Drbal
James Taylor 2013-03-07, 08:42
Lukáš Drbal 2013-03-07, 22:32