Support Questions
Find answers, ask questions, and share your expertise
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Getting Null pointer exception while calling UDAF


Getting Null pointer exception while calling UDAF

I am 

I am trying to run the below UDF.



add jar /home/UDF/stats-1.0.jar;

create temporary function diffdates1 as 'com.raj.udaf.UDAFDiffOfDates';

select diffdates1(time,click_date,end_date)  from abc ;




datatypes of three column parameters sent from select query are float,string,string respectively . I am using the same datatypes to match in method from java code.


In Java UDAF file, the below method will be called.


public boolean iterate(float o1, String o2, String o3) {


                                                System.out.println(" printing the first parameter=  " + o1);

                                                System.out.println(" printing the second parameter=  " + o2.toString());

                                                System.out.println(" printing the three parameter=  " + o3.toString());

                                                StringBuilder sb1 =  new StringBuilder();

                                                StringBuilder sb2 = new StringBuilder();

                                                StringBuilder sb3 = new StringBuilder();





                                                return true;






Though , I am giving the same datatypes, but unfortunately null values are sent in to the iterate method as the datatypes are not matching .


Due to above issue, i am getting null pointer exception. I tried a lot but no luck. Please help.