Does pig script support if-else statement
here is what I want to do:
if($NAME=='Joey') Do something else Do something
is that doable?
Thanks
Does pig script support if-else statement
here is what I want to do:
if($NAME=='Joey') Do something else Do something
is that doable?
Thanks
Its Called a "Bincond" Operator
Statements Like:
(Price > 75 ? 'High':'Low')
are also valid
For Handling Null Records:
((Name is null or IsEmpty(Name)) ? {('unknown')} : Name)
Use them in a foreach statement with alias along other fields i.e:
A = load 'x/y/Price.csv' as (Name, Product, Price);
B = foreach A generate Name, Product, Price, (Price > 75 ? 'High':'Low') as Indicator;
dump B;
If I understand correctly (I started pig latin yesterday), pig doesn't have if-else or for statement, you have to use python or java to do so, see here : http://chimera.labs.oreilly.com/books/1234000001811/ch09.html