Use Pig Latin:

Result = foreach table-1 generate column-1, column-2, ((column-3 >= 200) ? 20 : 
column-3); 

Thanks,
-Richard

-----Original Message-----
From: Katukuri, Jay [mailto:[email protected]] 
Sent: Wednesday, June 09, 2010 4:58 PM
To: [email protected]
Subject: if - else logic in Pig

Hello,
How do we implement the following "if-else" SQL logic in Pig ?

Select column-1, column-2,  if(column-3 >=200, 20, column-3) column_new_3
>From table-1

In the above SQL , if the value of a field (column-3) is greater than threshold 
(200), it uses some other value(20). Else, it uses the original value itself.

Thanks,
Jay

Reply via email to