hbase-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ramkrishna.S.Vasudevan" <ramkrishna.vasude...@huawei.com>
Subject RE: HBase Between Filters
Date Tue, 08 May 2012 12:05:47 GMT
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:anoopsj@huawei.com]
> Sent: Tuesday, May 08, 2012 4:04 PM
> To: dev@hbase.apache.org; hbase-dev@hadoop.apache.org
> 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 [bijieshan@huawei.com]
> Sent: Monday, May 07, 2012 8:31 PM
> To: dev@hbase.apache.org; hbase-dev@hadoop.apache.org
> Cc: Chenjian
> Subject: RE: HBase Between Filters
> 
> I just raised one issue regarding on this: HBASE-5950
> 
> -----Original Message-----
> From: sanky999 [mailto:sanky999@yahoo.co.in]
> Sent: Monday, May 07, 2012 9:24 PM
> To: hbase-dev@hadoop.apache.org
> 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.


Mime
View raw message