I am getting errors in AVG function. Can anyone please help on the following script: (Do i need to use tuple or bag while loading?) Thanks.
mydata = LOAD 'bigdata.txt' USING PigStorage(',') AS (stn , wban, yearmoda, temp, a , dewp :double, b , slp :double, c, stp :double, d, visib :double, e, wdsp :double, f, mxspd :double, gust :double, max :double, min :double, prcp :double, sndp :double, frshtt);
clean1 = FOREACH mydata GENERATE stn , wban, yearmoda, temp, a , dewp, b , slp, c, stp, d, visib, e, wdsp, f, mxspd, gust, max , min, prcp ,sndp , frshtt;
--clean2 = FILTER clean1 BY (temp == 9999.9);
tmpdata = FOREACH clean1 GENERATE stn, SUBSTRING(yearmoda, 0, 5) as year, temp;
C = GROUP tmpdata BY (year, temp);
avgtemp = FOREACH C GENERATE group, AVG(temp);