Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Plain View
Pig >> mail # user >> pig question


+
jamal sasha 2013-04-27, 09:32
+
Russell Jurney 2013-04-27, 09:41
+
abhishek 2013-05-07, 02:52
+
Jonathan Coveney 2013-05-07, 08:33
Copy link to this message
-
Re: Pig question
Coveney,

Thanks for the reply

Got the answer using nested foreach.

a = load 'data' using PigStorage(',');

b = foreach a {
c = substring(col1,0,4);
generate
332 as x,
c;
}

Sent from my iPhone

On May 7, 2013, at 4:33 AM, Jonathan Coveney <[EMAIL PROTECTED]> wrote:

> cdh-user to bcc
>
> Your question doesn't make much sense...I think you may have left a piece off?
>
>
> 2013/5/7 abhishek <[EMAIL PROTECTED]>
>> Hi all,
>>
>> In my script
>>
>> a = load 'data' using PigStorage();
>>
>> b = foreach a generate
>> 342 as col1,
>> substring(x,0,4) as col2,
>> ;
>>
>> I want to use col2 later in foreach statement.
>>
>> derived col2 should be used below.
>>
>> Regards
>> Abhi
>>
>> --
>
> --
>  
>  
>  
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB