-- A: (t0: chararray,t1: int,t2: int)
B = GROUP A BY t0 ;
C = FOREACH B {
-- Project out the first column of A.
projected = FOREACH A GENERATE t1, t2 ;
-- Now you can order the projection.
ordered = ORDER projected BY t1 ;
GENERATE group AS t0, ordered AS vals ;
}
您可以阅读有关嵌套的更多信息FOREACHs here http://pig.apache.org/docs/r0.10.0/basic.html#nestedblock.