hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Harsh J <ha...@cloudera.com>
Subject Re: question in retrieving data from hbase
Date Sat, 10 Mar 2012 12:18:23 GMT
Am not sure I understand what you are looking to do. Scanners work by
going over a row key start and end range and pull in every record for
the rows within the range. The records can additionally be specified
to be from just one or more CFs (or even qualified cols within).

What exactly is your key and their values (records) in the table here?
Could you sketch out a simple, mock example for us to understand
clearly?

On Sat, Mar 10, 2012 at 12:06 PM, newbie24 <shripriyad@hotmail.com> wrote:
>
>
>
> newbie24 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 row will be a combination of just
>> A+B.Is that possible?
>>
>>
>> I'm using scanner.setstartkey(start row).
>>
>>
>>
>> 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-tp33475136p33475136.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-tp33475136p33476040.html
> Sent from the HBase User mailing list archive at Nabble.com.
>



-- 
Harsh J

Mime
View raw message