hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ishan Chhabra <ichha...@rocketfuel.com>
Subject Re: HBase appends
Date Tue, 22 Jul 2014 02:20:19 GMT
Arun,
You need to represent your data in a format such that you can simply add a
byte[] to the end of the existing byte[] in a Cell and later read and
decode it as a list.

One way is to use the encode your data as protobuf. When you append a list
of values in byte[] form in protobuf to an existing list byte[] and read
the combined byte[], it is automatically recognized as one single list due
to the way protobuf encodes lists.

Another way to solve this problem is write a new column for each appended
list and read all the columns and combine when reading. (I prefer this
approach since the way Append is implemented internally, it can lead to
high memstore usage).


On Mon, Jul 21, 2014 at 5:43 PM, Arun Allamsetty <arun.allamsetty@gmail.com>
wrote:

> Hi,
>
> If I have a one-to-many relationship in a SQL database (an author might
> have written many books), and I want to denormalize it for writing in
> HBase, I'll have a table with the Author as the row key and a *list* of
> books as values.
>
> Now my question is how do I create a *list* such that I could just append
> to it using the HBase Java API *Append* instead of doing a
> read-modify-insert on a Java List object containing all the books.
>
> Thanks,
> Arun
>



-- 
*Ishan Chhabra *| Rocket Scientist | RocketFuel Inc.

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