hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Meil <doug.m...@explorysmedical.com>
Subject Re: question in retrieving data from hbase
Date Sat, 10 Mar 2012 13:08:31 GMT

Hi there-

There is a chapter in the Hbase RefGuide on the Hbase data model that
might be helpful.

http://hbase.apache.org/book.html#datamodel





On 3/10/12 1:30 AM, "newbie24" <shripriyad@hotmail.com> wrote:

>
>Thanks Harsh..little confused ..want to clarify some more....
>
>the row key i have is a combination of A+B+C+D
>so while retrieving the value the start key will be a combination of just
>A+B.Is that possible?
>
>
>Harsh J wrote:
>> 
>> Hello,
>> 
>> Yes, look at Scan and Get APIs, both of which allow you to add Columns
>> (Family and Qualifier both) to them.
>> 
>> Scan:
>> http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/Scan.html
>> Get:
>> http://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/Get.html
>> 
>> For instance, on the HBase shell, you can do this as:
>> 
>> hbase(main):002:0> create 'test', 'a', 'b', 'c', 'd'
>> hbase(main):003:0> put 'test', 'r1', 'a:x', 'x'
>> hbase(main):004:0> put 'test', 'r1', 'b:x', 'x'
>> hbase(main):005:0> put 'test', 'r1', 'c:x', 'x'
>> hbase(main):006:0> put 'test', 'r1', 'd:x', 'x'
>> hbase(main):007:0> put 'test', 'r2', 'd:y', 'y'
>> hbase(main):008:0> put 'test', 'r2', 'c:y', 'y'
>> hbase(main):009:0> put 'test', 'r2', 'b:y', 'y'
>> hbase(main):010:0> put 'test', 'r2', 'a:y', 'y'
>> 
>> hbase(main):011:0> scan 'test', {COLUMNS => ['a', 'c']}
>> ROW                   COLUMN+CELL
>>  r1                   column=a:x, timestamp=1331358809297, value=x
>>  r1                   column=c:x, timestamp=1331358815490, value=x
>>  r2                   column=a:y, timestamp=1331358841888, value=y
>>  r2                   column=c:y, timestamp=1331358836407, value=y
>> 
>> hbase(main):012:0> get 'test', 'r1', {COLUMNS => ['a', 'c']}
>> COLUMN                CELL
>>  a:x                  timestamp=1331358809297, value=x
>>  c:x                  timestamp=1331358815490, value=x
>> 
>> Do: help 'dml' for more docs from the HBase shell.
>> 
>> On Sat, Mar 10, 2012 at 4:29 AM, newbie24 <shripriyad@hotmail.com>
>>wrote:
>>>
>>> Hi,
>>>
>>> Can someone please answer this question .
>>>
>>> I have a column family say A,B,C D
>>> can I use just a partial of the column family to retrieve the
>>>data.Using
>>> the
>>> above example can my startrow combine values of column A abd B to
>>> retrieve
>>> a row from hbase.
>>>
>>>
>>> Not sure If I'm clear with my question.
>>>
>>> Thanks
>>>
>>> --
>>> View this message in context:
>>> 
>>>http://old.nabble.com/question-in-retrieving-data-from-hbase-tp33475136p
>>>33475136.html
>>> Sent from the HBase User mailing list archive at Nabble.com.
>>>
>> 
>> 
>> 
>> -- 
>> Harsh J
>> 
>> 
>
>-- 
>View this message in context:
>http://old.nabble.com/question-in-retrieving-data-from-hbase-tp33475136p33
>476028.html
>Sent from the HBase User mailing list archive at Nabble.com.
>
>



Mime
View raw message