|
|
-
Queries regarding Put and Scanner Result
Imran M Yousuf 2010-09-23, 04:15
Hi, I need some suggestions regarding usage of Put and ResultScanner's Result. First, the Result. Since we are using Object to row(s) we do a conversion of Object to row and vice versa. When doing row to object I am doing something like Result.next(int) then every result is converted to to its object in their individual thread, i.e. conversion of row to object takes place parallelly. Now my question is, will it have any effect if this conversion does take place in parallel? Second, when doing object to row, we are mapping a one to many relation in a specific column family, e.g. cf1, now when I will update the row I will populate cf1 with values set newly, e.g. old values are 1,2,3 and new values are 1,3,4, now I will populate cf1 to have 1,3,4. Now my first question is what will happen to the value '2'? When I do a scan/get on that row will cf1 return 1,3,4 or 1,2,3,4? If the answer is 1,2,3,4, when getting cf1 I want to get 1,3,4 only as it was set and not 2, what is the best way to achieve it? Thank you, -- Imran M Yousuf Twitter: @imyousuf - http://twitter.com/imyousufBlog: http://imyousuf-tech.blogs.smartitengineering.com/Mobile: +880-1711402557
-
Re: Queries regarding Put and Scanner Result
Andrey Stepachev 2010-09-23, 05:28
2010/9/23 Imran M Yousuf <[EMAIL PROTECTED]>: > Hi, > > > Second, when doing object to row, we are mapping a one to many > relation in a specific column family, e.g. cf1, now when I will update > the row I will populate cf1 with values set newly, e.g. old values are > 1,2,3 and new values are 1,3,4, now I will populate cf1 to have 1,3,4. > Now my first question is what will happen to the value '2'? When I do > a scan/get on that row will cf1 return 1,3,4 or 1,2,3,4? If the answer > is 1,2,3,4, when getting cf1 I want to get 1,3,4 only as it was set > and not 2, what is the best way to achieve it? How you populate family cf1? 1,2,3,4 = are qualifiers? or you put values under the same qualifiers? In case of qualifiers, you should delete qualifier+value explicitly. This can be done in two ways: 1. delete whole cf for given key http://hbase.apache.org/docs/r0.20.6/api/org/apache/hadoop/hbase/client/Delete.html#deleteFamily(byte[], long) 2. get current values, make diff with new value, and delete obsolete value. > > Thank you, > > -- > Imran M Yousuf > Twitter: @imyousuf - http://twitter.com/imyousuf> Blog: http://imyousuf-tech.blogs.smartitengineering.com/> Mobile: +880-1711402557 >
-
Re: Queries regarding Put and Scanner Result
Imran M Yousuf 2010-09-25, 03:54
On Thu, Sep 23, 2010 at 11:28 AM, Andrey Stepachev <[EMAIL PROTECTED]> wrote: > 2010/9/23 Imran M Yousuf <[EMAIL PROTECTED]>: >> <snip /> >> Second, when doing object to row, we are mapping a one to many >> relation in a specific column family, e.g. cf1, now when I will update >> the row I will populate cf1 with values set newly, e.g. old values are >> 1,2,3 and new values are 1,3,4, now I will populate cf1 to have 1,3,4. >> Now my first question is what will happen to the value '2'? When I do >> a scan/get on that row will cf1 return 1,3,4 or 1,2,3,4? If the answer >> is 1,2,3,4, when getting cf1 I want to get 1,3,4 only as it was set >> and not 2, what is the best way to achieve it? > > How you populate family cf1? 1,2,3,4 = are qualifiers? or you put values > under the same qualifiers? > > In case of qualifiers, you should delete qualifier+value explicitly. Hmm, this is the information I needed confirmation on. > This can be done in two ways: > 1. delete whole cf for given key > http://hbase.apache.org/docs/r0.20.6/api/org/apache/hadoop/hbase/client/Delete.html#deleteFamily(byte[], > long) > This is the brutforce approach. > 2. get current values, make diff with new value, and delete obsolete value. > This is the more elegant approach but for a lot of simultaneous Puts' it could be expensive. I will ponder on them and check how to implement them efficiently. Thanks, -- Imran M Yousuf Twitter: @imyousuf - http://twitter.com/imyousufBlog: http://imyousuf-tech.blogs.smartitengineering.com/Mobile: +880-1711402557
-
Re: Queries regarding Put and Scanner Result
Andrey Stepachev 2010-09-25, 18:12
2010/9/25 Imran M Yousuf <[EMAIL PROTECTED]>: > On Thu, Sep 23, 2010 at 11:28 AM, Andrey Stepachev <[EMAIL PROTECTED]> wrote: >> 2010/9/23 Imran M Yousuf <[EMAIL PROTECTED]>: >> How you populate family cf1? 1,2,3,4 = are qualifiers? or you put values >> under the same qualifiers? >> >> In case of qualifiers, you should delete qualifier+value explicitly. > > Hmm, this is the information I needed confirmation on. I mean that if you put values in a row: key1 { cf1:qual1:value1 cf1:qual2:value2 cf1:qual3:value3 } and then put key1 { cf1:qual1:value4 cf1:qual3:value5 } you row will be key1 { cf1:qual1:value4 cf1:qual2:value2 cf1:qual3:value5 } So, to remove cf1:qual2 you need to write null (hide value), or delete all versions of this qualifier. If you, for example delete cf1:qual3:value5, value3 will be returned on you get for cf1:qual3. This is how versioning works in hbase. > Thanks, > > -- > Imran M Yousuf > Twitter: @imyousuf - http://twitter.com/imyousuf> Blog: http://imyousuf-tech.blogs.smartitengineering.com/> Mobile: +880-1711402557 >
|
|