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

Switch to Plain View
Pig, mail # user - [HELP] How to split a string in pig script ?


+
Leon Town 2012-08-09, 05:37
+
Babu, Prashanth 2012-08-09, 06:10
Copy link to this message
-
Re: [HELP] How to split a string in pig script ?
Bill Graham 2012-08-09, 06:53
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.*
+
Leon Town 2012-08-10, 02:13
+
Leon Town 2012-08-22, 01:49
+
Bill Graham 2012-08-22, 04:32
+
Siddharth Tiwari 2012-08-22, 06:23