|
|
-
Sorting a tuple's content
Renato Marroquín Mogrovej... 2010-07-22, 01:33
Hey everybody, Does any body know how I can sort a tuple's content? For example, I have (770001,880001,990001,770001) and I would like to obtain (770001,770001,880001,990001). I tried doing a group by the first field but the thing is that I still get the whole tuple as a resultant bag. Thanks in advanced.
Renato M.
+
Renato Marroquín Mogrovej... 2010-07-22, 01:33
-
Re: Sorting a tuple's content
Dmitriy Ryaboy 2010-07-22, 02:01
that has to be a UDF, there is nothing built in for this.
On Wed, Jul 21, 2010 at 6:33 PM, Renato Marroquín Mogrovejo < [EMAIL PROTECTED]> wrote:
> Hey everybody, Does any body know how I can sort a tuple's content? > For example, I have (770001,880001,990001,770001) and I would like to > obtain > (770001,770001,880001,990001). I tried doing a group by the first field but > the thing is that I still get the whole tuple as a resultant bag. > Thanks in advanced. > > Renato M. >
+
Dmitriy Ryaboy 2010-07-22, 02:01
-
Re: Sorting a tuple's content
Renato Marroquín Mogrovej... 2010-07-22, 18:26
Thanks there Dmitriy. I will write my own then.
Renato M.
2010/7/21 Dmitriy Ryaboy <[EMAIL PROTECTED]>
> that has to be a UDF, there is nothing built in for this. > > On Wed, Jul 21, 2010 at 6:33 PM, Renato Marroquín Mogrovejo < > [EMAIL PROTECTED]> wrote: > > > Hey everybody, Does any body know how I can sort a tuple's content? > > For example, I have (770001,880001,990001,770001) and I would like to > > obtain > > (770001,770001,880001,990001). I tried doing a group by the first field > but > > the thing is that I still get the whole tuple as a resultant bag. > > Thanks in advanced. > > > > Renato M. > > >
+
Renato Marroquín Mogrovej... 2010-07-22, 18:26
-
Re: Sorting a tuple's content
Jai Krishna 2010-07-23, 06:03
So a question on a related note, is there any correlation between the way the tuple was constructed and the order of items in a Tuple?
E.g.
FOREACH foo GENERATE $1, $2, $3, $4
Would that guarantee (or not) that the ordering inside the tuple would also be ($1, $2, $3, $4)
-RJK
P.S: Im new to Pig so Im probably missing many things.
On 7/22/10 11:56 PM, "Renato Marroquín Mogrovejo" <[EMAIL PROTECTED]> wrote:
Thanks there Dmitriy. I will write my own then.
Renato M.
2010/7/21 Dmitriy Ryaboy <[EMAIL PROTECTED]>
> that has to be a UDF, there is nothing built in for this. > > On Wed, Jul 21, 2010 at 6:33 PM, Renato Marroquín Mogrovejo < > [EMAIL PROTECTED]> wrote: > > > Hey everybody, Does any body know how I can sort a tuple's content? > > For example, I have (770001,880001,990001,770001) and I would like to > > obtain > > (770001,770001,880001,990001). I tried doing a group by the first field > but > > the thing is that I still get the whole tuple as a resultant bag. > > Thanks in advanced. > > > > Renato M. > > >
+
Jai Krishna 2010-07-23, 06:03
-
Re: Sorting a tuple's content
Harsh J 2010-07-23, 07:43
Yes, that _will_ guarantee that the ordering is what you've specified.
On Fri, Jul 23, 2010 at 11:33 AM, Jai Krishna <[EMAIL PROTECTED]> wrote: > So a question on a related note, is there any correlation between the way the tuple was constructed and the order of items in a Tuple? > > E.g. > > FOREACH foo GENERATE $1, $2, $3, $4 > > Would that guarantee (or not) that the ordering inside the tuple would also be ($1, $2, $3, $4) > > -RJK > > P.S: Im new to Pig so Im probably missing many things. > > On 7/22/10 11:56 PM, "Renato Marroquín Mogrovejo" <[EMAIL PROTECTED]> wrote: > > Thanks there Dmitriy. I will write my own then. > > Renato M. > > 2010/7/21 Dmitriy Ryaboy <[EMAIL PROTECTED]> > >> that has to be a UDF, there is nothing built in for this. >> >> On Wed, Jul 21, 2010 at 6:33 PM, Renato Marroquín Mogrovejo < >> [EMAIL PROTECTED]> wrote: >> >> > Hey everybody, Does any body know how I can sort a tuple's content? >> > For example, I have (770001,880001,990001,770001) and I would like to >> > obtain >> > (770001,770001,880001,990001). I tried doing a group by the first field >> but >> > the thing is that I still get the whole tuple as a resultant bag. >> > Thanks in advanced. >> > >> > Renato M. >> > >> > >
-- Harsh J www.harshj.com
+
Harsh J 2010-07-23, 07:43
-
Re: Sorting a tuple's content
Jai Krishna 2010-07-26, 03:49
Ok. That helps. So for this situation, we need not write a new UDF; we can just use FOREACH...GENERATE to rearrange the tuple columns.
-RJK On 7/23/10 1:13 PM, "Harsh J" <[EMAIL PROTECTED]> wrote:
Yes, that _will_ guarantee that the ordering is what you've specified.
On Fri, Jul 23, 2010 at 11:33 AM, Jai Krishna <[EMAIL PROTECTED]> wrote: > So a question on a related note, is there any correlation between the way the tuple was constructed and the order of items in a Tuple? > > E.g. > > FOREACH foo GENERATE $1, $2, $3, $4 > > Would that guarantee (or not) that the ordering inside the tuple would also be ($1, $2, $3, $4) > > -RJK > > P.S: Im new to Pig so Im probably missing many things. > > On 7/22/10 11:56 PM, "Renato Marroquín Mogrovejo" <[EMAIL PROTECTED]> wrote: > > Thanks there Dmitriy. I will write my own then. > > Renato M. > > 2010/7/21 Dmitriy Ryaboy <[EMAIL PROTECTED]> > >> that has to be a UDF, there is nothing built in for this. >> >> On Wed, Jul 21, 2010 at 6:33 PM, Renato Marroquín Mogrovejo < >> [EMAIL PROTECTED]> wrote: >> >> > Hey everybody, Does any body know how I can sort a tuple's content? >> > For example, I have (770001,880001,990001,770001) and I would like to >> > obtain >> > (770001,770001,880001,990001). I tried doing a group by the first field >> but >> > the thing is that I still get the whole tuple as a resultant bag. >> > Thanks in advanced. >> > >> > Renato M. >> > >> > >
-- Harsh J www.harshj.com
+
Jai Krishna 2010-07-26, 03:49
-
Re: Sorting a tuple's content
Renato Marroquín Mogrovej... 2010-07-26, 04:58
Wouldn't that add extra overhead to the process? I mean to do an extra FOREACH ... GENERATE won't cause an extra Mapreduce job to be generated?
Renato M.
2010/7/25 Jai Krishna <[EMAIL PROTECTED]>
> Ok. That helps. > So for this situation, we need not write a new UDF; we can just use > FOREACH...GENERATE to rearrange the tuple columns. > > -RJK > > > On 7/23/10 1:13 PM, "Harsh J" <[EMAIL PROTECTED]> wrote: > > Yes, that _will_ guarantee that the ordering is what you've specified. > > On Fri, Jul 23, 2010 at 11:33 AM, Jai Krishna <[EMAIL PROTECTED]> wrote: > > So a question on a related note, is there any correlation between the way > the tuple was constructed and the order of items in a Tuple? > > > > E.g. > > > > FOREACH foo GENERATE $1, $2, $3, $4 > > > > Would that guarantee (or not) that the ordering inside the tuple would > also be ($1, $2, $3, $4) > > > > -RJK > > > > P.S: Im new to Pig so Im probably missing many things. > > > > On 7/22/10 11:56 PM, "Renato Marroquín Mogrovejo" < > [EMAIL PROTECTED]> wrote: > > > > Thanks there Dmitriy. I will write my own then. > > > > Renato M. > > > > 2010/7/21 Dmitriy Ryaboy <[EMAIL PROTECTED]> > > > >> that has to be a UDF, there is nothing built in for this. > >> > >> On Wed, Jul 21, 2010 at 6:33 PM, Renato Marroquín Mogrovejo < > >> [EMAIL PROTECTED]> wrote: > >> > >> > Hey everybody, Does any body know how I can sort a tuple's content? > >> > For example, I have (770001,880001,990001,770001) and I would like to > >> > obtain > >> > (770001,770001,880001,990001). I tried doing a group by the first > field > >> but > >> > the thing is that I still get the whole tuple as a resultant bag. > >> > Thanks in advanced. > >> > > >> > Renato M. > >> > > >> > > > > > > > > -- > Harsh J > www.harshj.com > >
+
Renato Marroquín Mogrovej... 2010-07-26, 04:58
-
Re: Sorting a tuple's content
Dmitriy Ryaboy 2010-07-26, 05:35
it will not.
On Sun, Jul 25, 2010 at 9:58 PM, Renato Marroquín Mogrovejo < [EMAIL PROTECTED]> wrote:
> Wouldn't that add extra overhead to the process? I mean to do an extra > FOREACH ... GENERATE won't cause an extra Mapreduce job to be generated? > > Renato M. > > 2010/7/25 Jai Krishna <[EMAIL PROTECTED]> > > > Ok. That helps. > > So for this situation, we need not write a new UDF; we can just use > > FOREACH...GENERATE to rearrange the tuple columns. > > > > -RJK > > > > > > On 7/23/10 1:13 PM, "Harsh J" <[EMAIL PROTECTED]> wrote: > > > > Yes, that _will_ guarantee that the ordering is what you've specified. > > > > On Fri, Jul 23, 2010 at 11:33 AM, Jai Krishna <[EMAIL PROTECTED]> wrote: > > > So a question on a related note, is there any correlation between the > way > > the tuple was constructed and the order of items in a Tuple? > > > > > > E.g. > > > > > > FOREACH foo GENERATE $1, $2, $3, $4 > > > > > > Would that guarantee (or not) that the ordering inside the tuple would > > also be ($1, $2, $3, $4) > > > > > > -RJK > > > > > > P.S: Im new to Pig so Im probably missing many things. > > > > > > On 7/22/10 11:56 PM, "Renato Marroquín Mogrovejo" < > > [EMAIL PROTECTED]> wrote: > > > > > > Thanks there Dmitriy. I will write my own then. > > > > > > Renato M. > > > > > > 2010/7/21 Dmitriy Ryaboy <[EMAIL PROTECTED]> > > > > > >> that has to be a UDF, there is nothing built in for this. > > >> > > >> On Wed, Jul 21, 2010 at 6:33 PM, Renato Marroquín Mogrovejo < > > >> [EMAIL PROTECTED]> wrote: > > >> > > >> > Hey everybody, Does any body know how I can sort a tuple's content? > > >> > For example, I have (770001,880001,990001,770001) and I would like > to > > >> > obtain > > >> > (770001,770001,880001,990001). I tried doing a group by the first > > field > > >> but > > >> > the thing is that I still get the whole tuple as a resultant bag. > > >> > Thanks in advanced. > > >> > > > >> > Renato M. > > >> > > > >> > > > > > > > > > > > > > > -- > > Harsh J > > www.harshj.com > > > > >
+
Dmitriy Ryaboy 2010-07-26, 05:35
|
|