apache pig - Pig reverses order of grouped tuples -


I am running a pig script that flattens a bag, filters it, and saves it back together A UDF issue is so that I can pass it to the last date [before the last value] DESC is in order, when I want them in the ASC order

EX:

  ((RRRRRR #, T2, 19840101011), {(RRRRR #, T2, 1984 840101011-3.04.25,01-01-2014, 31-03-2014,01-03-2014-201010101197) , (RRRRRR #, T2, 1984 840101013-3.03.75, 01 -01-2014, 3 1-03-2014,01-02-2014-201010101197), (RRRRRR #, T-2, 1984 840101011,3.0,3.75, 01-01-2014, 31-03-2014, 01-01-2014, 20140101197 What I need:  
  (RRRRRR #, T2, 19848401011), {(RRRRRR # , T2, 19840101011,3.0,3.75,01-01-2014, 31-03-201401-01-2014,20140101197), (RRRRRR #, T2, 1984 840101011,3.0,3.75, 01-01- 2014, 31-03- 2014, 01-02-2014-201010101197), (RRRRRR #, T2, 1984 840101011-3.04.25 ,01-01-2014, 31-03-2014, 01-03-2014, 01010101017, 7)}) // "It is necessary ORDER  

Is there a way to order a tuple in a bag? If not, how can I prevent group commands from sorting them like this?

. So you can not guarantee that whatever changes you make will preserve the order. However, if you need to guarantee an order at a certain step, then you have nested FOREACH :

  b = inside  ORDER BY , FOREACH is a {field2_ord = ORDER field 2 by date; Generate field 1, field 2_ORD; };  

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -