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 05:57:57 GMT

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 raw message