|
|
-
RE: How do I flatten the first item in a bag after a group?Chan, Tim 2012-02-10, 23:34
Thanks Alan. In my use case this works for me.
________________________________________ From: Alan Gates [[EMAIL PROTECTED]] Sent: Friday, February 10, 2012 2:38 PM To: [EMAIL PROTECTED] Subject: Re: How do I flatten the first item in a bag after a group? first_tup = foreach x_grp { inner = limit $1 1; generate flatten(inner); } Note however that "first" has no real meaning here, as bags do not guarantee any order. You're really just getting a random tuple from the bag. You can order the bag by inserting an order statement inside the foreach before the limit. Alan. On Feb 10, 2012, at 2:28 PM, Chan, Tim wrote: > > > x_grp = group x by $18; > > How do I output the first tuple in the bag generated by the group? |