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

Switch to Threaded View
Pig >> mail # user >> PIG: Transform based on value in field


Copy link to this message
-
Re: PIG: Transform based on value in field
B = foreach A generate a1, (a2 == 0 ? a2 + 1 : a2) as a2, a3;

Alan.

On May 14, 2013, at 9:10 AM, Ashish Gupta wrote:

> I want to something like this
>
> B = FOREACH A GENERATE a1, *if a2 = 0: a2=a2+1 else a2*, a3)
>
> how to do " if a2 = 0: a2=a2+1 else a2" in PIG
>
> (or it could be "if a2 matches < some regex>: a2+0 else a2")
>
>
> I am using Pig 0.10