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 yourFilterList
:KeyOnlyFilter()
: only scan rows, not columns (to make it faster)FirstKeyOnlyFilter()
: same as above, use both of themPrefixFilter(prefix)
: that's your prefixPageFilter(N)
: return only N rowsAlso, make sure to set the right condition setting (i.e. whether all these conditions should be met or some of them). To make all of them meet, use
FilterList.Operator.MUST_PASS_ALL