One small correction...
Scan.setTimeStamp(long) specifies:
* Get versions of columns with the specified timestamp.
That is, you will only get results with that exact timestamp.
If you want to get all stamps:
Scan.setTimeRange(long, long) specifies:
* Get versions of columns only within the specified timestamp range,
[minStamp, maxStamp).
So to get all versions:
scan.setTimeRange(0, Long.MAX_VALUE)
stack wrote:
You have to be using 0.20.0 RC2 to do the below. The below also presumes
that each value has a different timestamp; i.e. you don't expect to add
multiple values against same timestamp.
// Presumes you already have a table instance named 'table'.
Scan scan = new Scan(Bytes.toBytes("ID1:ID2"));
scan.addColumn(Bytes.toBytes("family_name"),
Bytes.toBytes("qualifier_term"));
scan.setTimeStamp(ts); // This gets all from the timestamp and older. Use
setTimeRange if you want to set a range.
// Optionally, if you want to cap versions returned, see setMaxVersions.
ResultScanner scanner = table.getScanner(scan);
.....
The above is how I'd do it. Elegance is a tag I'm rarely associated with so
there may be a better way...
Hopefuly this helps
St.Ack
On Fri, Aug 28, 2009 at 1:59 PM, Nikhil Gupta <[email protected]> wrote:
Hi,
I am new to HBase, so please forgive if this question is too basic.
We are building a system that stores time series data for different terms
in
column qualifiers.
So, we plan to store data in the form :
KeyID -> "ID1:ID2"
Family:Qualifier -> "family_name:qualifier_term"
Values -> Traffic for that term with different timestamps
We will pull this data to display a trends kind of chart on front end.
Now if I want to get all the values for different timestamps for a
particular column while scanning, how can I do that via a scanner in the
most elegant manner ?
[assuming that I know exact values for id1:id2 but not for qualifier_term.]
Thanks
-nikhil
http://stanford.edu/~nikgupta <http://stanford.edu/%7Enikgupta>