hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul van Hoven <paul.van.ho...@googlemail.com>
Subject Rowkey design question
Date Tue, 19 Feb 2013 16:11:02 GMT
Hi,

I'm currently playing with hbase. The design of the rowkey seems to be
critical.

The rowkey for a certain database table of mine is:

timestamp+ipaddress

It looks something like this when performing a scan on the table in the shell:
hbase(main):012:0> scan 'ToyDataTable'
ROW                                         COLUMN+CELL
 1357020000000+192.168.178.9                column=CF:SampleCol,
timestamp=1361288601717, value=Entry_1 = 2013-01-01 07:00:00

Since I got several rows for different timestamps I'd like to tell a
scan to just a region of the table for example from 2013-01-07 to
2013-01-09. Previously I only had a timestamp as the rowkey and I
could restrict the rowkey like that:

SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
			Date startDate = formatter.parse("2013-01-07 07:00:00");
			Date endDate = formatter.parse("2013-01-10 07:00:00");
			
			HTableInterface toyDataTable = pool.getTable("ToyDataTable");
			Scan scan = new Scan( Bytes.toBytes( startDate.getTime() ),
Bytes.toBytes( endDate.getTime() ) );

But this no longer works with my new design.

Is there a way to tell the scan object to filter the rows with respect
to the timestamp, or do I have to use a filter object?

Mime
View raw message