我是 PIG 的新手,想计算我的一列数据的平均值,看起来像
0
10.1
20.1
30
40
50
60
70
80.1
我写了这个猪脚本
dividends = load 'myfile.txt' as (A);
dump dividends
grouped = group dividends by A;
avg = foreach grouped generate AVG(grouped.A);
dump avg
它将数据解析为
(0)
(10.1)
(20.1)
(30)
(40)
(50)
(60)
(70)
(80.1)
但给出这个错误的平均值
2013-03-04 15:10:58,289 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1200: Pig script failed to parse:
<file try.pig, line 4, column 41> Invalid scalar projection: grouped
Details at logfile: /Users/PreetiGupta/Documents/CMPS290S/project/pig_1362438645642.log
任何的想法