- In pig
concat
keyword should be in Capital letters
not small letters. You need to change the keyword concat
to CONCAT
.
- You are loading a CSV file with default delimiter(tab). Are you sure that your csv file is tab separate delimiter for each field? other wise you will get a weird result. Incase your csv file is comma separated delimiter then specify the explicit delimiter as comma in the PigStorage.
- Its always safe to specify the schema during load, it will avoid unnecessary explicit typecast.
Sample example:
input.csv
1,aaa,[email protected]
2,bbb,[email protected]
3,ccc,[email protected]
PigScript:
a = load 'input.csv' using PigStorage(',') as (id:int, name:chararray, email:chararray);
b = foreach a generate id, CONCAT('test', name);
DUMP b;
Output:
(1,testaaa)
(2,testbbb)
(3,testccc)
Incase your csv file is already tab separated delimiter then fix only the CONCAT
issue.