Does HBase have any command that works like SQL LIMIT
query?
I can do it by setStart
and setEnd
, but I do not want to iterate all
There is a filter called PageFilter. Its meant for this purpose.
Scan scan = new Scan(Bytes.toBytes("smith-"));
scan.addColumn(Bytes.toBytes("personal"), Bytes.toBytes("givenName"));
scan.addColumn(Bytes.toBytes("contactinfo"), Bytes.toBytes("email"));
scan.setFilter(new PageFilter(25));
ResultScanner scanner = table.getScanner(scan);
for (Result result : scanner) {
// ...
}
http://java.dzone.com/articles/handling-big-data-hbase-part-4