I have a relation as below loaded into "calls".
(Header India) (Call1) (Call2) (END) (Header NZ) (Call1) (Call2) (END)
I am trying to update the relation so that it becomes as below and I can group by the 2nd field to get country wise call counts.
(Header India, Header India) (Call1, Header India) (Call2, Header India) (END, Header India) (Header NZ, Header NZ) (Call1, Header NZ ) (Call2, Header NZ) (END, Header NZ)
The first tuple will always be (Header ). I am using the below code where I want to update the constant and then extract that constant as 2nd field. But it is not working. Any suggestions?
%declare HeaderText 'Header ' calls = LOAD 'Data File'; extrctd = FOREACH calls GENERATE $0 as (country:chararray), (SUBSTRING($0,1,7)=='Header '?'$HeaderText'=$0:'$HeaderText') as (txt:chararray);
Aucun commentaire:
Enregistrer un commentaire