You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Leo Alekseyev <dn...@gmail.com> on 2010/12/08 06:27:33 UTC

Are there any examples of simple UDAFs?

I am trying to write a very simple aggregation function which seems
like an overkill for using GenericUDAF as described on the wiki.
However, I can't get the code to run.  It always throws an exception
of the form

java.lang.ClassNotFoundException:
com.hadoopbook.hive.Maximum$MaximumIntUDAFEvaluator

(As you can see, even the sample code from Tom White's Hadoop book --
the only sample code I found -- doesn't work.)  I'm using the standard
add jar and create temporary function statements...

--Leo

Re: Are there any examples of simple UDAFs?

Posted by Leo Alekseyev <dn...@gmail.com>.
Good point Tim -- one non-generic UDAF example is in
org.apache.hadoop.hive.ql.udf.UDAFPercentile.

My problem turned out to be classpath related.  Remember kids, if
classes aren't being found for the UDFs and UDAFs, list jars and
delete jar can be your friends!

--Leo

On Tue, Dec 7, 2010 at 9:39 PM, Tim Robertson <ti...@gmail.com> wrote:
> What about the count or max?
>  http://svn.apache.org/repos/asf/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFCount.java
>  http://svn.apache.org/repos/asf/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFMax.java
>
> I've not used UDAFs, but I only got my UDTFs working by looking at the
> examples in the Hive SVN itself.
>
> HTH,
> Tim
>
>
> On Wed, Dec 8, 2010 at 3:27 PM, Leo Alekseyev <dn...@gmail.com> wrote:
>> I am trying to write a very simple aggregation function which seems
>> like an overkill for using GenericUDAF as described on the wiki.
>> However, I can't get the code to run.  It always throws an exception
>> of the form
>>
>> java.lang.ClassNotFoundException:
>> com.hadoopbook.hive.Maximum$MaximumIntUDAFEvaluator
>>
>> (As you can see, even the sample code from Tom White's Hadoop book --
>> the only sample code I found -- doesn't work.)  I'm using the standard
>> add jar and create temporary function statements...
>>
>> --Leo
>>
>

Re: Are there any examples of simple UDAFs?

Posted by Tim Robertson <ti...@gmail.com>.
What about the count or max?
  http://svn.apache.org/repos/asf/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFCount.java
  http://svn.apache.org/repos/asf/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFMax.java

I've not used UDAFs, but I only got my UDTFs working by looking at the
examples in the Hive SVN itself.

HTH,
Tim


On Wed, Dec 8, 2010 at 3:27 PM, Leo Alekseyev <dn...@gmail.com> wrote:
> I am trying to write a very simple aggregation function which seems
> like an overkill for using GenericUDAF as described on the wiki.
> However, I can't get the code to run.  It always throws an exception
> of the form
>
> java.lang.ClassNotFoundException:
> com.hadoopbook.hive.Maximum$MaximumIntUDAFEvaluator
>
> (As you can see, even the sample code from Tom White's Hadoop book --
> the only sample code I found -- doesn't work.)  I'm using the standard
> add jar and create temporary function statements...
>
> --Leo
>