问题描述:

In h base my row key is of the form string+date e.g : abc+01/03/2012

Searching is based on 3 parameters (String,date,date) :

1.) First parameter string should match with row key before + sign, for that i have got

Filter rowFilter=new RowFilter(CompareOp.EQUAL, new BinaryPrefixComparator(Bytes.toBytes(ticker)));

because this is searching prefix, if I search for "ab", I will get results for "ab" and "abc", what could be the condition for getting exact match?

2.) Second parameter date should be > then row key date extracted from row key abc+01/03/2012.

3.) Third parameter date should be < then row key date extracted from row key abc+01/03/2012.

basically dates should fall between provided dates only.

What is the possible solution for this? thnx

网友答案:

Try to use scan with setting start row and stop row, so, you set start row= string+timestamp_1, stop row = string+timestamp_2.

If you need to find row like 'string*'+ts, then you need to write your own DatePostfixComparator(startTs, endTs).

The second case will be slower than first.

相关阅读:
Top