Could not infer the matching function for org.apache.pig.builtin.AVG as multiple or none of them fit. Please use an explicit cast -
i want calculate average time question..
a= load '/user/priyanka/book1.csv' (qid:chararray,at:datetime); b= foreach generate qid question,(datetime)at time; c= group b question; d= foreach c generate group, (datetime) avg(b.time);
getting error here:
please use explicit cast.
example of qid:56783978 , at: 23:45:30
how solve?
in last line calling avg on bag of datetime records. avg works on numeric types. https://pig.apache.org/docs/r0.11.0/api/org/apache/pig/builtin/avg.html
you might want convert times unix epochs. can calculate average of unix timestamps because numeric. http://pig.apache.org/docs/r0.11.0/api/org/apache/pig/builtin/tounixtime.html
Comments
Post a Comment