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 rows.
These are the commands that operate on the tables in HBase. create - Creates a table. list - Lists all the tables in HBase. disable - Disables a table.
whoami. This command “whoami” is used to return the current HBase user information from the HBase cluster.
From the HBase shell you can use LIMIT:
hbase> scan 'test-table', {'LIMIT' => 5} From the Java API you can use Scan.setMaxResultSize(N) or scan.setMaxResultsPerColumnFamily(N).
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With