Just adding on to Anoop's reply
SingleColumnValueFilter filter1 = new
SingleColumnValueFilter(Bytes.toBytes("TRAN"),
Bytes.toBytes("TRAN_ID"),
CompareFilter.CompareOp.GREATER, new
BinaryComparator(Bytes.toBytes(1000)));
filter1.setFilterIfMissing(true);
filters.add(filter1);
SingleColumnValueFilter filter2 = new
SingleColumnValueFilter(Bytes.toBytes("TRAN"),
Bytes.toBytes("TRAN_ID"),
CompareFilter.CompareOp.LESS,new
BinaryComparator(Bytes.toBytes(2000)));
If you had inserted the value as Integer and then retrieve it as integer
using Bytes.toBytes then you can get the intended result.
Regards
Ram
> -----Original Message-----
> From: Anoop Sam John [mailto:[email protected]]
> Sent: Tuesday, May 08, 2012 4:04 PM
> To: [email protected]; [email protected]
> Subject: RE: HBase Between Filters
>
> @sanky
>
> "It still picks up record 120, 117... when given range is 1000-2000."
>
> How you have saved the int data value into HBase column? Have you not
> used Bytes.toBytes(int) ?? If you have used the same, the
> BinaryComparator would have worked fine I guess..
> ________________________________________
> From: Bijieshan [[email protected]]
> Sent: Monday, May 07, 2012 8:31 PM
> To: [email protected]; [email protected]
> Cc: Chenjian
> Subject: RE: HBase Between Filters
>
> I just raised one issue regarding on this: HBASE-5950
>
> -----Original Message-----
> From: sanky999 [mailto:[email protected]]
> Sent: Monday, May 07, 2012 9:24 PM
> To: [email protected]
> Subject: Re: HBase Between Filters
>
> @Yifeng - Nope no success. I tried both ways:
> BinaryComparator as well as directly passing bytes none worked.
> It still picks up record 120, 117... when given range is 1000-2000.
>
> --
> View this message in context: http://apache-
> hbase.679495.n3.nabble.com/HBase-Between-Filters-tp3962242p3968518.html
> Sent from the HBase - Developer mailing list archive at Nabble.com.