You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Michael Dagaev <mi...@gmail.com> on 2008/11/04 19:32:20 UTC

Question on update

Hi, all

    Let there is a row in People table. The column family Details
consists of name, address, and email.
Now I have a Person object which corresponds to this row. This object
contains name and address
but email is null.

    In order to update the row with the new data from the Person
object. I have to read the row, compare it
with my object and store only the difference. Is it correct?

Thank you for your cooperation,
M.

Re: [LIKELY JUNK]Question on update

Posted by stack <st...@duboce.net>.
Thank you, that's fine but what if down the road
I want to remove the nail color attribute (and other attributes
that I do not remember) ?


It'll just hang out there until you explicitly delete it (or, if you have
set your schema to expire cells, it'll be removed after the time-to-live has
passed).
St.Ack



On Thu, Nov 6, 2008 at 12:27 AM, stack <st...@duboce.net> wrote:

> As long as they are all of the person family (or some pre-existing
> columnfamily), that should be fine (and during updates you prefix Map keys
> with columnfamily name).  You'll have person:name, person:address and
> person:email.  If three months down the road you add nail color, and you do
> an update, the new 'nail color' attribute will be added as 'person:nail
> color'.
>
> St.Ack
>
>
> On Wed, Nov 5, 2008 at 11:49 PM, Michael Dagaev <mi...@gmail.com>wrote:
>
>> Hi, Hui
>>
>>     It is Ok if "Person" (in my example) is a class
>> with "name", "address", and "email" fields.
>>
>>     However, what if this "Person" is just a map,
>> where "name", "address", and "email" are keys
>> I do not know in advance ?
>>
>> Thank you for your cooperation,
>> M.
>>
>> On Tue, Nov 4, 2008 at 8:51 PM, Ding, Hui <hu...@sap.com> wrote:
>> > Why do you need to compare it? Just store a new version for every
>> > attribute/column that is not null.
>> >
>> > -----Original Message-----
>> > From: Michael Dagaev [mailto:michael.dagaev@gmail.com]
>> > Sent: Tuesday, November 04, 2008 10:32 AM
>> > To: hbase-user@hadoop.apache.org
>> > Subject: [LIKELY JUNK]Question on update
>> >
>> > Hi, all
>> >
>> >    Let there is a row in People table. The column family Details
>> > consists of name, address, and email.
>> > Now I have a Person object which corresponds to this row. This object
>> > contains name and address
>> > but email is null.
>> >
>> >    In order to update the row with the new data from the Person
>> > object. I have to read the row, compare it
>> > with my object and store only the difference. Is it correct?
>> >
>> > Thank you for your cooperation,
>> > M.
>> >
>>
>
>

Re: [LIKELY JUNK]Question on update

Posted by stack <st...@duboce.net>.
As long as they are all of the person family (or some pre-existing
columnfamily), that should be fine (and during updates you prefix Map keys
with columnfamily name).  You'll have person:name, person:address and
person:email.  If three months down the road you add nail color, and you do
an update, the new 'nail color' attribute will be added as 'person:nail
color'.

St.Ack

On Wed, Nov 5, 2008 at 11:49 PM, Michael Dagaev <mi...@gmail.com>wrote:

> Hi, Hui
>
>     It is Ok if "Person" (in my example) is a class
> with "name", "address", and "email" fields.
>
>     However, what if this "Person" is just a map,
> where "name", "address", and "email" are keys
> I do not know in advance ?
>
> Thank you for your cooperation,
> M.
>
> On Tue, Nov 4, 2008 at 8:51 PM, Ding, Hui <hu...@sap.com> wrote:
> > Why do you need to compare it? Just store a new version for every
> > attribute/column that is not null.
> >
> > -----Original Message-----
> > From: Michael Dagaev [mailto:michael.dagaev@gmail.com]
> > Sent: Tuesday, November 04, 2008 10:32 AM
> > To: hbase-user@hadoop.apache.org
> > Subject: [LIKELY JUNK]Question on update
> >
> > Hi, all
> >
> >    Let there is a row in People table. The column family Details
> > consists of name, address, and email.
> > Now I have a Person object which corresponds to this row. This object
> > contains name and address
> > but email is null.
> >
> >    In order to update the row with the new data from the Person
> > object. I have to read the row, compare it
> > with my object and store only the difference. Is it correct?
> >
> > Thank you for your cooperation,
> > M.
> >
>

Re: [LIKELY JUNK]Question on update

Posted by Michael Dagaev <mi...@gmail.com>.
Hi, Hui

     It is Ok if "Person" (in my example) is a class
with "name", "address", and "email" fields.

     However, what if this "Person" is just a map,
where "name", "address", and "email" are keys
I do not know in advance ?

Thank you for your cooperation,
M.

On Tue, Nov 4, 2008 at 8:51 PM, Ding, Hui <hu...@sap.com> wrote:
> Why do you need to compare it? Just store a new version for every
> attribute/column that is not null.
>
> -----Original Message-----
> From: Michael Dagaev [mailto:michael.dagaev@gmail.com]
> Sent: Tuesday, November 04, 2008 10:32 AM
> To: hbase-user@hadoop.apache.org
> Subject: [LIKELY JUNK]Question on update
>
> Hi, all
>
>    Let there is a row in People table. The column family Details
> consists of name, address, and email.
> Now I have a Person object which corresponds to this row. This object
> contains name and address
> but email is null.
>
>    In order to update the row with the new data from the Person
> object. I have to read the row, compare it
> with my object and store only the difference. Is it correct?
>
> Thank you for your cooperation,
> M.
>

RE: [LIKELY JUNK]Question on update

Posted by "Ding, Hui" <hu...@sap.com>.
Why do you need to compare it? Just store a new version for every
attribute/column that is not null.

-----Original Message-----
From: Michael Dagaev [mailto:michael.dagaev@gmail.com] 
Sent: Tuesday, November 04, 2008 10:32 AM
To: hbase-user@hadoop.apache.org
Subject: [LIKELY JUNK]Question on update

Hi, all

    Let there is a row in People table. The column family Details
consists of name, address, and email.
Now I have a Person object which corresponds to this row. This object
contains name and address
but email is null.

    In order to update the row with the new data from the Person
object. I have to read the row, compare it
with my object and store only the difference. Is it correct?

Thank you for your cooperation,
M.

Re: Question on update

Posted by Michael Dagaev <mi...@gmail.com>.
Thanks

On Tue, Nov 4, 2008 at 9:06 PM, Jonathan Gray <jl...@streamy.com> wrote:
> No, you can (and should) just write the entire object each time, at least in
> my experience.
>
> You will create new versions of the Cells that you are overwriting with the
> same value, but you will definitely be paying less of a cost than you would
> with requiring a read and diff before each write.
>
> JG
>
> -----Original Message-----
> From: Michael Dagaev [mailto:michael.dagaev@gmail.com]
> Sent: Tuesday, November 04, 2008 10:32 AM
> To: hbase-user@hadoop.apache.org
> Subject: Question on update
>
> Hi, all
>
>    Let there is a row in People table. The column family Details
> consists of name, address, and email.
> Now I have a Person object which corresponds to this row. This object
> contains name and address
> but email is null.
>
>    In order to update the row with the new data from the Person
> object. I have to read the row, compare it
> with my object and store only the difference. Is it correct?
>
> Thank you for your cooperation,
> M.

RE: Question on update

Posted by Jonathan Gray <jl...@streamy.com>.
No, you can (and should) just write the entire object each time, at least in
my experience.

You will create new versions of the Cells that you are overwriting with the
same value, but you will definitely be paying less of a cost than you would
with requiring a read and diff before each write.

JG

-----Original Message-----
From: Michael Dagaev [mailto:michael.dagaev@gmail.com] 
Sent: Tuesday, November 04, 2008 10:32 AM
To: hbase-user@hadoop.apache.org
Subject: Question on update

Hi, all

    Let there is a row in People table. The column family Details
consists of name, address, and email.
Now I have a Person object which corresponds to this row. This object
contains name and address
but email is null.

    In order to update the row with the new data from the Person
object. I have to read the row, compare it
with my object and store only the difference. Is it correct?

Thank you for your cooperation,
M.