Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Pig >> mail # user >> [HELP] How to split a string in pig script ?


Copy link to this message
-
Re: [HELP] How to split a string in pig script ?
Oh Bill, you're really genius.
Thanks!

2012/8/9 Bill Graham <[EMAIL PROTECTED]>

> Something like this should do it:
>
> A = FOREACH data GENERATE name, FLATTEN(TOKENIZE(ids));
>
>
> On Wed, Aug 8, 2012 at 11:10 PM, Babu, Prashanth <
> [EMAIL PROTECTED]
> > wrote:
>
> > Can you also post the sample input and the desired output you are looking
> > for?
> >
> > Thanks,
> > Prashanth.
> >
> > -----Original Message-----
> > From: Leon Town [mailto:[EMAIL PROTECTED]]
> > Sent: Thursday, August 09, 2012 11:08 AM
> > To: [EMAIL PROTECTED]
> > Subject: [HELP] How to split a string in pig script ?
> >
> > The input schema is:
> > *{name:chararray, ids:chararray}*,
> >
> > and the format of *ids* is like:
> > id1,id2,id3,...,idn
> >
> > Now, I want to split *ids* and change the input into the below format:
> > name   id1
> > name   id2
> > ...
> > name   idn
> >
> >
> > How should I do this by pig script, instead of UDFs.
> >
> > Thanks!
> >
> > ______________________________________________________________________
> > Disclaimer:This email and any attachments are sent in strictest
> confidence
> > for the sole use of the addressee and may contain legally privileged,
> > confidential, and proprietary data.  If you are not the intended
> recipient,
> > please advise the sender by replying promptly to this email and then
> delete
> > and destroy this email and any attachments without any further use,
> copying
> > or forwarding
> >
>
>
>
> --
> *Note that I'm no longer using my Yahoo! email address. Please email me at
> [EMAIL PROTECTED] going forward.*
>