如何依靠猪的两个项目分组

时间:2015-07-06 11:05:42

标签: hadoop apache-pig

我已经从'n'列中生成了两列(起点和终点)。现在我想为这两个列组合生成计数。我无法得到结果。我收到错误,因为错误1070:无法使用导入解析Count: 下面是我的脚本,

mydata = load '/Projects/Flightdata/1987/Rawdata' using PigStorage(',') as (year:int, month:int, dom:int, dow:int, deptime:long, crsdeptime:long, arrtime:long, crsarrtime:long, uniqcarcode:chararray, flightnum:long, tailnum:chararray, actelaptime:long, crselaptime:long, airtime:long, arrdeltime:long, depdeltime:long, origcode:chararray, destcode:chararray, dist:long, taxintime:long, taxiouttime:long, flightcancl:int, canclcode:chararray, diverted:int, carrierdel:long, weatherdel:long, nasdel:long, securitydel:long, lateaircraftdel:long);

Step2 = foreach mydata generate origcode, destcode;
grpby = group Step2 by (origcode, destcode) ;
step3 = foreach grpby generate group.origcode as source,  group.destcode as destination, Count(step2);

这里我想为每个起源和目的地组合生成计数。 任何指导都会有所帮助。

1 个答案:

答案 0 :(得分:1)

请参阅Pig documentation about case sensitivity

  

Pig Latin函数的名称区分大小写。