小智 86
从HBase shell中,您可以使用LIMIT:
hbase> scan 'test-table', {'LIMIT' => 5}
Run Code Online (Sandbox Code Playgroud)
从您可以使用的Java API Scan.setMaxResultSize(N)
或scan.setMaxResultsPerColumnFamily(N)
.
小智 13
有一个名为PageFilter的过滤器.它意味着这个目的.
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) {
// ...
}
Run Code Online (Sandbox Code Playgroud)
http://java.dzone.com/articles/handling-big-data-hbase-part-4
如果使用HBase Shell,则可以使用以下命令来限制查询结果:"LIMIT"必须用单引号括起来.
scan 'table-name', {'LIMIT' => 10}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
49725 次 |
最近记录: |