You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by Kristopher Kane <kk...@gmail.com> on 2014/01/06 17:12:33 UTC

Custom filter comparator

I have two qualifiers that contain latitude and longitude longs.  I wish to
write a filter comparator that will look at these two qualifiers and
determine if they exist within a supplied bounding box. - This will compare
four longs passed in as min/max values against what is found in the
qualifiers.

Looking at the built-in comparators like RegexStringComparator and
BinaryComparator, it looks like I must extend ByteArrayComparable and then
create a ComparatorProtos for my custom comparator.

I understand extending ByteArrayComparable but a custom ComparatorProtos to
facilitate ByteArrayComparable.parseFrom is a bit much to just look at a
couple of longs.

Are the above steps the right approach to for this kind of work or am I
missing something?

Thanks,

-Kris

Re: Custom filter comparator

Posted by Kristopher Kane <kk...@gmail.com>.
> example<https://github.com/hbaseinaction/gis>could give you some idea.
>
>
This is it.  I didn't realize all that Nick had done on the GIS side.

Thanks,

-Kris

Re: Custom filter comparator

Posted by Haosong Huang <ha...@gmail.com>.
I think a more efficient way is to use geohash as rowkey. And scan the
hbase with start row and end row. May be this
example<https://github.com/hbaseinaction/gis>could give you some idea.


On Tue, Jan 7, 2014 at 12:12 AM, Kristopher Kane <kk...@gmail.com>wrote:

> I have two qualifiers that contain latitude and longitude longs.  I wish to
> write a filter comparator that will look at these two qualifiers and
> determine if they exist within a supplied bounding box. - This will compare
> four longs passed in as min/max values against what is found in the
> qualifiers.
>
> Looking at the built-in comparators like RegexStringComparator and
> BinaryComparator, it looks like I must extend ByteArrayComparable and then
> create a ComparatorProtos for my custom comparator.
>
> I understand extending ByteArrayComparable but a custom ComparatorProtos to
> facilitate ByteArrayComparable.parseFrom is a bit much to just look at a
> couple of longs.
>
> Are the above steps the right approach to for this kind of work or am I
> missing something?
>
> Thanks,
>
> -Kris
>



-- 
Best Regards,
Haosdent Huang

Re: Custom filter comparator

Posted by Ted Yu <yu...@gmail.com>.
Kris:
You're looking at HBase 0.96, right ?

What described is the standard way of serializing comparator using
protobuf. This is to facilitate your expanding what may be included in the
comparison in the future.

Cheers


On Mon, Jan 6, 2014 at 8:12 AM, Kristopher Kane <kk...@gmail.com>wrote:

> I have two qualifiers that contain latitude and longitude longs.  I wish to
> write a filter comparator that will look at these two qualifiers and
> determine if they exist within a supplied bounding box. - This will compare
> four longs passed in as min/max values against what is found in the
> qualifiers.
>
> Looking at the built-in comparators like RegexStringComparator and
> BinaryComparator, it looks like I must extend ByteArrayComparable and then
> create a ComparatorProtos for my custom comparator.
>
> I understand extending ByteArrayComparable but a custom ComparatorProtos to
> facilitate ByteArrayComparable.parseFrom is a bit much to just look at a
> couple of longs.
>
> Are the above steps the right approach to for this kind of work or am I
> missing something?
>
> Thanks,
>
> -Kris
>