本文介绍了像HBase中的SQL LIMIT这样的命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HBase是否有像 SQL LIMIT 查询那样的命令?

Does HBase have any command that works like SQL LIMIT query?

我可以通过 setStart setEnd ,但我不想迭代所有行。

I can do it by setStart and setEnd, but I do not want to iterate all rows.

推荐答案

从HBase shell可以使用LIMIT:

From the HBase shell you can use LIMIT:

hbase> scan 'test-table', {'LIMIT' => 5}

在Java API中,您可以使用 Scan.setMaxResultSize(N) scan.setMaxResultsPerColumnFamily(N)

From the Java API you can use Scan.setMaxResultSize(N) or scan.setMaxResultsPerColumnFamily(N).




  • HBase API docs - Scan.setMaxResultSize
  • HBase API docs - Scan.setMaxResultsPerColumnFamily

这篇关于像HBase中的SQL LIMIT这样的命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 15:41
查看更多