You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@hadoop.apache.org by Something Something <lu...@yahoo.com> on 2009/09/30 00:02:00 UTC
ArrayList as a column value?
Hello,
How do I add values from an ArrayList to a column in a HTable?
Let's say I have a "Product" table with columns: name, desc. Now I
want to add to each row a list of categories that a product belongs
to. I tried the following:
for (String category : categories) {
put.add(Bytes.toBytes("info"), Bytes.toBytes("categories"), Bytes.toBytes(category));
}
This doesn't work as expected. It only keeps one (last) category. The
rest get overwritten. I tried using 'version', but that didn't work
either. There's a put(KeyValue) method. Is that the one I am supposed
to use?
Any help in this regard will be greatly appreciated. Thanks.