You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Bui Ngoc Son <ge...@gmail.com> on 2011/05/06 06:36:07 UTC

How to rename a rowkey

Hi,

Is there any way to rename a rowkey in Hbase? for example i want to 
change a row key from "abcd_1_2010" to "abcd_1_2011".

If no, what is the best way to copy date from one row to another row? I 
will use it to copy 1st row to new 2nd row, then delete 1st row.

Thanks.

Re: How to rename a rowkey

Posted by lohit <lo...@gmail.com>.
Additionally if your table is very big. You might be able to use
CopyTable.java ( by modifying Import.java) to run mapreduce job to convert
you keys.

2011/5/6 Stack <st...@duboce.net>

> On Fri, May 6, 2011 at 8:06 AM, Bui Ngoc Son <ge...@gmail.com>
> wrote:
> > Thank for your reply, St.Ack,
> >
> > Could you plz tell me how to copy data between 2 rows? is there any API
> for
> > this? or i have to read and write between them families by families,
> columns
> > by columns manually
> >
>
> Yes, you will have to do a Get or a Scan fetching whole row and then
> Put whats returned with your new key format.
> St.Ack


>
> > On 5/6/2011 12:16 PM, Stack wrote:
> >>
> >> On Thu, May 5, 2011 at 9:36 PM, Bui Ngoc Son<ge...@gmail.com>
> >>  wrote:
> >>>
> >>> Hi,
> >>>
> >>> Is there any way to rename a rowkey in Hbase? for example i want to
> >>> change a
> >>> row key from "abcd_1_2010" to "abcd_1_2011".
> >>>
> >> No.
> >>
> >>> If no, what is the best way to copy date from one row to another row? I
> >>> will
> >>> use it to copy 1st row to new 2nd row, then delete 1st row.
> >>>
> >> Thats the way to do it.
> >>
> >> Good luck,
> >> St.Ack
> >
> >
>



-- 
Have a Nice Day!
Lohit

Re: How to rename a rowkey

Posted by Stack <st...@duboce.net>.
On Fri, May 6, 2011 at 8:06 AM, Bui Ngoc Son <ge...@gmail.com> wrote:
> Thank for your reply, St.Ack,
>
> Could you plz tell me how to copy data between 2 rows? is there any API for
> this? or i have to read and write between them families by families, columns
> by columns manually
>

Yes, you will have to do a Get or a Scan fetching whole row and then
Put whats returned with your new key format.
St.Ack


> On 5/6/2011 12:16 PM, Stack wrote:
>>
>> On Thu, May 5, 2011 at 9:36 PM, Bui Ngoc Son<ge...@gmail.com>
>>  wrote:
>>>
>>> Hi,
>>>
>>> Is there any way to rename a rowkey in Hbase? for example i want to
>>> change a
>>> row key from "abcd_1_2010" to "abcd_1_2011".
>>>
>> No.
>>
>>> If no, what is the best way to copy date from one row to another row? I
>>> will
>>> use it to copy 1st row to new 2nd row, then delete 1st row.
>>>
>> Thats the way to do it.
>>
>> Good luck,
>> St.Ack
>
>

Re: How to rename a rowkey

Posted by Bui Ngoc Son <ge...@gmail.com>.
Thank for your reply, St.Ack,

Could you plz tell me how to copy data between 2 rows? is there any API 
for this? or i have to read and write between them families by families, 
columns by columns manually

On 5/6/2011 12:16 PM, Stack wrote:
> On Thu, May 5, 2011 at 9:36 PM, Bui Ngoc Son<ge...@gmail.com>  wrote:
>> Hi,
>>
>> Is there any way to rename a rowkey in Hbase? for example i want to change a
>> row key from "abcd_1_2010" to "abcd_1_2011".
>>
> No.
>
>> If no, what is the best way to copy date from one row to another row? I will
>> use it to copy 1st row to new 2nd row, then delete 1st row.
>>
> Thats the way to do it.
>
> Good luck,
> St.Ack


Re: How to rename a rowkey

Posted by Stack <st...@duboce.net>.
On Thu, May 5, 2011 at 9:36 PM, Bui Ngoc Son <ge...@gmail.com> wrote:
> Hi,
>
> Is there any way to rename a rowkey in Hbase? for example i want to change a
> row key from "abcd_1_2010" to "abcd_1_2011".
>

No.

> If no, what is the best way to copy date from one row to another row? I will
> use it to copy 1st row to new 2nd row, then delete 1st row.
>

Thats the way to do it.

Good luck,
St.Ack