How could I display the SUM of the sizes for the same Classification and Type in the following example please?
((classification,Secret),(type,Document.Office),{((size,557856))})
((classification,Secret),(type,Blog.ExternalPost),{((size,4478993))})
((classification,Secret),(type,Social.Post.Twitter),{((size,1902045))})
((classification,Secret),(type,Social.Post.Facebook),{((size,2085060)),((size,557856)),((size,1555956))})
((classification,External),(type,Blog.ExternalPost),{((size,1902045))})
((classification,External),(type,Blog.InternalPost),{((size,1438853))})
((classification,External),(type,Social.Post.Facebook),{((size,1234311)),((size,4260972))})
This is the output from the describe function for the above relation in Pig;
{classification: (name: chararray,value: chararray),type: (name: chararray,value: chararray),{(size: (name: chararray,value: int))}}
I've tried the following but with no luck:
sum = foreach groupedfinal generate $0, $1, SUM($2);
Error: Could not infer the matching function for org.apache.pig.builtin.SUM as multiple or none of them fit. Please use an explicit cast
Your help would be greatly appreciated.
Thanks Mskh