简体   繁体   English

HBase prefixFilter与startRow和PageFilter一起使用

[英]HBase prefixFilter works with startRow and PageFilter

In Hbase, I have rowkey like this : userId:timestamp:objectId. 在Hbase中,我有这样的行键:userId:timestamp:objectId。 I'm trying to create a method like this: 我正在尝试创建这样的方法:

public List<Object> getObjectList(String userId, String startrowA, int limit) 

I want to get records with prefix userId, and also have paging(startrow+limit). 我想获取带有前缀userId的记录,并且还具有分页(startrow + limit)。

So how I use prefixFilter, pageFilter to do this? 那么我如何使用prefixFilter,pageFilter做到这一点呢? Thanks 谢谢

If I understood your question correctly, you can try using the FilterList class and add to it a few filters that collectively will allow you to achieve what you are looking for. 如果我正确理解了您的问题,则可以尝试使用FilterList类,并向其中添加一些过滤器,这些过滤器将共同使您实现所需的功能。 Try adding the following filters to your FilterList : 尝试将以下过滤器添加到FilterList

KeyOnlyFilter() : only scan rows, not columns (to make it faster) KeyOnlyFilter() :仅扫描行,不扫描列(以使其更快)

FirstKeyOnlyFilter() : same as above, use both of them FirstKeyOnlyFilter() :与上面相同,两者都使用

PrefixFilter(prefix) : that's your prefix PrefixFilter(prefix) :这是您的前缀

PageFilter(N) : return only N rows PageFilter(N) :仅返回N行

Also, make sure to set the right condition setting (ie whether all these conditions should be met or some of them). 另外,请确保设置正确的条件设置(即是否应满足所有这些条件或其中某些条件)。 To make all of them meet, use FilterList.Operator.MUST_PASS_ALL 要使它们全部满足,请使用FilterList.Operator.MUST_PASS_ALL

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM