init() is called for all the aggregation evaluators, then terminatePartial() is called.
In your code, init() function is not overriding GenericUDAFEvaluator.init(Mode m, ObjectInspector[] parameters). Hive calls GenericUDAFEvaluator.init. Was the signature of the method wrong in your code? Thanks Amareshwari On 2/15/11 10:23 PM, "Aurora Skarra-Gallagher" <aur...@yahoo-inc.com> wrote: Hi, I wrote a simple UDAF for Hive 0.6 and I had to include null checks in terminatePartial even though the object should never be null if init is always called before terminatePartial. For instance, my init function: public void init() { result = new StringBuffer(); } My terminatePartial function: public String terminatePartial() { if (result == null) { return new String(); } // Remove trailing comma, if string isn't blank if (result.length() > 0 && result.charAt(result.length() - 1) == ',') { result.deleteCharAt(result.length() - 1); } return result.toString(); } If I don't have that initial null check, when the results are empty that I'm applying my UDAF to, I get a NullPointerException. It makes me think that terminatePartial can be called with no init call. Is that possible? Thanks, Aurora