运行PIG脚本时出错

时间:2014-12-09 14:52:42

标签: hadoop apache-pig

x = load '/home/manish/Work/inputs/testInput.txt' using PigStorage(',') AS (key:chararray , value:int);
y = group x bt key;
r = foreach y { m = generate x.value AS one; ord_m = ORDER m BY one desc; lim_m = LIMIT ord_m 3; generate group, lim_m;};

错误改为:

2014-12-09 20:07:45,978 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1200: <line 4, column 29>  mismatched input 'x' expecting LEFT_PAREN

即在第三行。

r = foreach y { m = generate x.value AS one; ord_m = ORDER m BY one desc; lim_m = LIMIT ord_m 3; generate group, lim_m;};

1 个答案:

答案 0 :(得分:0)

你能试试吗?

x = load '/home/manish/Work/inputs/testInput.txt' using PigStorage(',') AS (key:int , value:int);
y = group x by key;
r = foreach y {
                 ord_m = ORDER x BY value  desc;
                 lim_m = LIMIT ord_m 3;
                 generate group, lim_m;
              };
dump r;