Ah ha! So the row key orders the results, I just do an unbounded Scan, and stop after N iterations.

Like this...

       Scan scan = new Scan();
       Filter filter = new SingleColumnValueFilter(...);
       scan.setFilter(filter);
       ResultScanner scanner = hTable.getScanner(scan);
       Iterator<Result> it = scanner.iterator();
       for ( int i=0; i<1000 && it.hasNext(); i++) {
           Result result = it.next();
           ... do stuff with result...
       }

Do I have to worry about efficiency? Is the Server madly retrieving rows, in the background, that the Client will never use?

Thanks
P



On 3/2/12 4:31 PM, Doug Meil wrote:
Hi there-

Take a look at this section of the book...

http://hbase.apache.org/book.html#reverse.timestamp




On 3/2/12 4:02 PM, "Peter Wolf"<[email protected]>  wrote:

Hello all,

I want to retrieve the most recent N rows from a table, with some column
qualifiers.

I can't find a Filter, or anything obvious in my books, or via Google.

What is the idiom for doing this?

Thanks
Peter



Reply via email to