Great...
The example is here...
I'm trying to get the performance related history data given the date.This
date is not related to the timestamp of hbase
This is my RowKey = NENAME +DATE+AID+AIDTYPE+LOCATION+DIRECTION
BTW,NENAme = network element name
Column Family = cf
This is the description of my table
NAME => 'tsdb', FAMILIES => [{NAME => 'cf', BLOOMFILTER => 'NONE',
REPLICATION_SCOPE => ' true
0', COMPRESSION => 'NONE', VERSIONS => '3', TTL => '2147483647', BLOCKSIZE
=> '65536', IN_
MEMORY => 'false', BLOCKCACHE => 'true'}, {NAME => 't', BLOOMFILTER =>
'NONE', REPLICATION
_SCOPE => '0', VERSIONS => '3', COMPRESSION => 'NONE', TTL => '2147483647',
BLOCKSIZE => '
65536', IN_MEMORY => 'false', BLOCKCACHE => 'true'}]}
this is sample entry when i run scan from my table.
ROW
\x00\x00\x01OW\xF6\x80\x00\x01\x00\x00\x01\x00\x01\x01\x01
COLUMN+CELL
column=cf:\x00\x10-\xBF, timestamp=1331231100482,
value=Ax_H\x90\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
This is the entry when i run get
hbase(main):003:0> get
'tsdb',"\x00\x00\x01OW\xF6\x80\x00\x02\x00\x00\x05\x00\x06\x01\x01"
COLUMN
cf:\x00\x10-\xBF
CELL
timestamp=1331250356437,
value=\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\
00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x0
0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00
There is gong to be 2 million records or more ,
Now I'm scanning the records given a portion of the row key
using Scan = scanner.setStartKey(startRow)
here my startrow will be "nename1+date1" and endwow will be "naname1+date2"
If you see i'm using only a portion of the row key to get the records.Is
this possible or do I need to frame the entire row key to get the data.
Please let me know if this explanation is clear.
Thanks and regards
Harsh J wrote:
>
> 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 <[email protected]> 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 <[email protected]>
>>>> 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
>
>
--
View this message in context:
http://old.nabble.com/question-in-retrieving-data-from-hbase-tp33475136p33477167.html
Sent from the HBase User mailing list archive at Nabble.com.