hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ted Yu <yuzhih...@gmail.com>
Subject Re: Using RowMutations to replace all columns of a row
Date Tue, 28 May 2013 14:42:56 GMT
Over in HBASE-8626, Jean-Marc and Andrew voiced the opinion that the
current behavior may not be a bug.

Vinod:

What do you think ?

On Sat, May 25, 2013 at 4:53 PM, Vinod V <vinodv26@gmail.com> wrote:

> I have a HBase table with a single column family and columns are added to
> it over time. These columns are named as the timestamp they were created,
> so unless I query the row I do not know what all columns it has.
>
> Now given a row, I want to _atomically_ remove all the existing columns of
> this column family and add a new set of columns and values.
>
> So I thought of using RowMutations like:
>
> ==============
> RowMutations mutations = new RowMutations(row);
>
> //delete the column family
> Delete delete = new Delete(row);
> delete.deleteFamily(cf);
>
> //add new columns
> Put put = new Put(row);
> put.add(cf, col1, v1);
> put.add(cf, col2, v2);
>
> //delete column family and add new columns to same family
> mutations.add(delete);
> mutations.add(put);
>
> table.mutateRow(mutations);
> ==============
>
> But what this code ends up doing is just deleting the column family, it
> does not add the new columns. Is this behaviour expected?
>
> If so, then how can I achieve my goal of _atomically_ replacing all columns
> of a column family with a new set of columns?
>
> Thanks,
> Vinod
>

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