You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by Calvin Cheung <cc...@twitter.com> on 2012/07/31 03:05:35 UTC
User Defined Comparator
Since ComparisonFunc is now depreciated, what is its replacement? I can't
any information in the Javadoc. Is it safe to continue to extend
ComparisonFunc for custom ordering?
Thanks.
Calvin
Re: User Defined Comparator
Posted by Jonathan Coveney <jc...@gmail.com>.
Calvin,
Generally, the pattern is to make a new column which represents whatever
you want things to be compared on, and then partition/order/whatever on
that column. There are some cases where this is insufficient, but 99.9% of
the time I've found it to be fine.
Jon
2012/8/9 Alan Gates <ga...@hortonworks.com>
> There isn't a replacement for ComparisonFunc. That was written before Pig
> had types so that users could do type specific comparison functions. With
> the addition of types it was felt that ComparisonFunc was no longer
> necessary. That said, it's never been removed. The testing is limited at
> this point, so I don't know how well it works. If you find it works for
> you though you could still use it.
>
> Alan.
>
> On Jul 30, 2012, at 6:05 PM, Calvin Cheung wrote:
>
> > Since ComparisonFunc is now depreciated, what is its replacement? I can't
> > any information in the Javadoc. Is it safe to continue to extend
> > ComparisonFunc for custom ordering?
> >
> > Thanks.
> > Calvin
>
>
Re: User Defined Comparator
Posted by Alan Gates <ga...@hortonworks.com>.
There isn't a replacement for ComparisonFunc. That was written before Pig had types so that users could do type specific comparison functions. With the addition of types it was felt that ComparisonFunc was no longer necessary. That said, it's never been removed. The testing is limited at this point, so I don't know how well it works. If you find it works for you though you could still use it.
Alan.
On Jul 30, 2012, at 6:05 PM, Calvin Cheung wrote:
> Since ComparisonFunc is now depreciated, what is its replacement? I can't
> any information in the Javadoc. Is it safe to continue to extend
> ComparisonFunc for custom ordering?
>
> Thanks.
> Calvin