Hey all,
I'm trying to write a UDAF as follows, borrowing heavily from the UDAF example
on slide 84 from this deck:
http://www.slideshare.net/ragho/hive-user-meeting-august-2009-facebook
<snip>
public class UDAFPercentUnderThreshold extends UDAF {
public static class State {
private LongWritable totalCount;
private LongWritable underCount;
}
public static class Evaluator implements UDAFEvaluator {
State s;
public void init() {
s.totalCount = new LongWritable(0);
s.underCount = new LongWritable(0);
}
public boolean iterate(LongWritable start, LongWritable end,
IntWritable threshold) {
...
}
public State terminatePartial() {
...
}
public boolean merge(State o) {
...
}
public Double terminate() {
...
}
}
}
</snip>
I then register the UDAF but when I try to use it, I get the following error:
hive> select PERCENT_UNDER_THRESHOLD(impressionrequesttime, coreloadtime, 2000)
from foo where day = '2009-08-31' and hour = 3;
FAILED: Unknown exception : Internal error: Cannot get typeName for class
foo.udf.UDAFPercentUnderThreshold$State
I'm using a trunk build. I looked through the code and found where the
exception gets thrown, but I can't figure out what exactly it is trying to do.
Any help would be much appreciated!
Jason