Flaglist = load '/flag.txt' using PigStorage (',') as (countryname:chararray, landmass:int, Zone:int, Area:int, Population:int, Language:int, Religion:int, Bars:int, stripes:int, Colours:int,red:int, green:int, blue:int, gold:int, white:int, black:int, orange:int, mainhue:chararray, noofcircles:int, noofuprightcrosses:int, noofdiagonalcrosses:int, noofquarters:int, noofsunstarts:int, crescent:int, triangle:int, icon:int ,animate:int, text:int, topleft:chararray, bottomright:chararray );
Sumofbs = FOREACH Flaglist GENERATE Bars+stripes ;
OrderBS = FOREACH Sumofbs GENERATE Flaglist.countryname ;
ANS: -
2016-03-22 21:47:27,284 [主要] INFO org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.MapReduceLauncher - 有些工作失败了!停止运行所有相关工作2016-03-22 21:47:27,358 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1066:无法打开别名OrderBS的迭代器。后端错误: 标量在输出中有多行。第1名:(阿富汗,5,1,648,16,10,2,0,3,5,1,1,0,1,1,1,0,绿色,0,0,0,0,1 ,0,0,1,0,0,黑,绿) 第2 (阿尔巴尼亚,3,1,29,3,6,6,0,0,3,1,0,0,1,0,1,0,红色,0,0,0,0,1,0, 0,0,1,0,红色,红色)
答案 0 :(得分:1)
Flaglist = load '/flag.txt' using PigStorage (',') as (countryname:chararray, landmass:int, Zone:int, Area:int, Population:int, Language:int, Religion:int, Bars:int, stripes:int, Colours:int,red:int, green:int, blue:int, gold:int, white:int, black:int, orange:int, mainhue:chararray, noofcircles:int, noofuprightcrosses:int, noofdiagonalcrosses:int, noofquarters:int, noofsunstarts:int, crescent:int, triangle:int, icon:int ,animate:int, text:int, topleft:chararray, bottomright:chararray );
Sumofbs = FOREACH Flaglist GENERATE countryname,Bars+stripes as Total;
OrderBS = ORDER Sumofbs BY $1 DESC;
FinalOrderBS = LIMIT OrderBS 5;
DUMP FinalOrderBS;