Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
HBase >> mail # user >> HBase: Filters not working for negative integers


Copy link to this message
-
Re: HBase: Filters not working for negative integers
You'll need to flip the sign bit for ints and longs like Phoenix does.
Feel free to borrow our serializers (in PDataType) or just use Phoenix.

Thanks,

     James

On 06/26/2013 12:16 AM, Madhukar Pandey wrote:
> Please ignore my previous mail..there was some copy paste issue in it..
> this is the correct mail..
>
>
> We have implemented QualifierFilter as well as ValueFilter (using
> BinaryComparator) of Hbase successfully and they are working fine for most
> of our cases. However they are failing in cases like number > -10 or number
> < -10
>
> Please note that number = -10 is working perfectly fine. Also, number > 10
> and number < 10 are also working fine.
>
> If you want to see the code, please check following links:
> 1. QualifierFilter - Relevant lines are 126-142
> https://github.com/deanhiller/playorm/blob/master/src/main/java/com/alvazan/orm/layer9z/spi/db/hadoop/CursorColumnSliceHbase.java
>
>
> 2. Value Filter - Relevant lines are 107-128
> https://github.com/deanhiller/playorm/blob/master/src/main/java/com/alvazan/orm/layer9z/spi/db/hadoop/CursorOfHbaseIndexes.java
>
>
> As per this blog(http://flurrytechblog.wordpress.com/2012/06/12/137492485/),
> this can be an issue with serialization if we want to store negative values
> for rowkeys and we should write our own serializers for comparison.
> So we wanted to know:
> 1. Is it really necessary to write our own serializer in this case?
> 2. If yes, how? Any example would be great help.
>
>
>
>
>
> On Wed, Jun 26, 2013 at 12:33 PM, Madhukar Pandey <[EMAIL PROTECTED]>wrote:
>
>> We have implemented QualifierFilter as well as ValueFilter (using
>> BinaryComparator) of Hbase successfully and they are working fine for
>> most of our cases. However they are failing in cases like number > -10 or number
>> < -10
>>
>> Please note that number = -10 is working perfectly fine. Also, number > 10
>> and number < 10 are also working fine.
>>
>> If you want to see the code, please check following links:
>> 1. Q<https://github.com/deanhiller/playorm/blob/master/src/main/java/com/alvazan/orm/layer9z/spi/db/hadoop/CursorColumnSliceHbase.java>We
>> have implemented QualifierFilter as well as ValueFilter (using
>> BinaryComparator) of Hbase successfully and they are working fine for most
>> of our cases. However they are failing in cases like number > -10 or number
>> < -10
>>
>>
>> Please note that number = -10 is working perfectly fine. Also, number > 10
>> and number < 10 are also working fine.
>>
>>
>> If you want to see the code, please check following links:
>>
>> 1. QualifierFilter - Relevant lines are 126-142
>>
>> 2. Value Filter - Relevant lines are 107-128
>>
>>
>> As per this blog, this can be an issue with serialization if we want to
>> store negative values for rowkeys and we should write our own serializers
>> for comparison.
>>
>> So we wanted to know:
>>
>> 1. Is it really necessary to write our own serializer in this case?
>>
>> 2. If yes, how? Any example would be great help.ualifierFilter<https://github.com/deanhiller/playorm/blob/master/src/main/java/com/alvazan/orm/layer9z/spi/db/hadoop/CursorColumnSliceHbase.java> -
>> Relevant lines are 126-142
>> 2. Value Filter<https://github.com/deanhiller/playorm/blob/master/src/main/java/com/alvazan/orm/layer9z/spi/db/hadoop/CursorOfHbaseIndexes.java> -
>> Relevant lines are 107-128
>>
>> As per this blog<http://flurrytechblog.wordpress.com/2012/06/12/137492485/>,
>> this can be an issue with serialization if we want to store negative values
>> for rowkeys and we should write our own serializers for comparison.
>> So we wanted to know:
>> 1. Is it really necessary to write our own serializer in this case?
>> 2. If yes, how? Any example would be great help.
>>