In Hbase, I have rowkey like this : 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).
So how I use prefixFilter, pageFilter to do this? 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. Try adding the following filters to your FilterList
:
KeyOnlyFilter()
: only scan rows, not columns (to make it faster)
FirstKeyOnlyFilter()
: same as above, use both of them
PrefixFilter(prefix)
: that's your prefix
PageFilter(N)
: return only N rows
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.