Row pagination with HBase

眉间皱痕 提交于 2019-12-30 07:05:10

问题


Is there a way to do pagination in HBase based on rowkeys?

I wanted to have the same effect as I do in SQL with SELECT * FROM table LIMIT 10 OFFSET 10.

If that's not possible, how should I best design my rowkeys to query appropriately?


回答1:


You can make use of PageFilter to do that. When you create the instance of PageFilter, you specify a pageSize parameter, which controls how many rows per page should be returned.

Filter filter = new PageFilter(10);

And if you wish to do it through the HBase shell you can use LIMIT with your SCAN query :

scan 'table', LIMIT => 10




回答2:


What about using the ColumnPaginationFilter?

scan 't1', {FILTER => org.apache.hadoop.hbase.filter.ColumnPaginationFilter.new(<count>, <start_offset>)}


来源:https://stackoverflow.com/questions/17981450/row-pagination-with-hbase

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!