Sorting pig如何按一个bag值对tuple进行排序

Sorting pig如何按一个bag值对tuple进行排序,sorting,apache-pig,Sorting,Apache Pig,我有这样一个数据集:{movie:chararry,year:int,weight:float,actor:chararray} 我试图找出每年体重最高的运动。所以我按年份和电影对场景进行分组,然后得到以下场景: {group: (year:int, movie:chararray), movies:{(movie:chararry, year:int, weight:float, actor:chararray)}} 我的问题是如何根据行李价值和重量对集合进行排序?。谢谢您可以在FOREAC

我有这样一个数据集:
{movie:chararry,year:int,weight:float,actor:chararray}

我试图找出每年体重最高的运动。所以我按年份和电影对场景进行分组,然后得到以下场景:

{group: (year:int, movie:chararray), movies:{(movie:chararry, year:int, weight:float, actor:chararray)}}

我的问题是如何根据行李价值和重量对集合进行排序?。谢谢

您可以在FOREACH中使用嵌套语句

inpt = load '...../data.csv' using PigStorage(',') as (movie:chararry, year:int, weight:float, actor:chararray);

grp = group inpt by (year, movie);

srt = foreach grp {
    by_wright = ORDER inpt BY weight;
    generate group, by_wright;
};

可以在FOREACH中使用嵌套语句

inpt = load '...../data.csv' using PigStorage(',') as (movie:chararry, year:int, weight:float, actor:chararray);

grp = group inpt by (year, movie);

srt = foreach grp {
    by_wright = ORDER inpt BY weight;
    generate group, by_wright;
};

可以在FOREACH中使用嵌套语句

inpt = load '...../data.csv' using PigStorage(',') as (movie:chararry, year:int, weight:float, actor:chararray);

grp = group inpt by (year, movie);

srt = foreach grp {
    by_wright = ORDER inpt BY weight;
    generate group, by_wright;
};

可以在FOREACH中使用嵌套语句

inpt = load '...../data.csv' using PigStorage(',') as (movie:chararry, year:int, weight:float, actor:chararray);

grp = group inpt by (year, movie);

srt = foreach grp {
    by_wright = ORDER inpt BY weight;
    generate group, by_wright;
};