I have some data with a target of 4 values and I want three of these to become part of one single using latin pig.
Input: Output:
ID | Target ID | Target
----------------- -----------------
test1 1 test1 1
test2 1 test2 1
test3 2 test3 2
test4 2 test4 2
test5 3 test5 2
test6 4 test6 2
test7 2 test7 2
Someone knows the best way to do it
Use Bincond to check for target value greater than 1 and if true replace it with the value you want,in this case 2.
A = LOAD 'data.txt' USING PigStorage('\t') AS (Id:chararray,target:int);
B = FOREACH A GENERATE Id,(target > 1 ? 2 : target);
DUMP B;