Hi there,

I would need to do something like this:

A = LOAD 'student' USING PigStorage() AS (name:chararray, region:chararry,
iq:int);
DUMP A;
(John, There, 10)
(Alf, There, 10)
(ET, There, 10)
(Mary, Here, 80)
(Bill, Here, 100)
(Joe, Here, 150)

total_iq_per_region = GROUP A BY (region);

total_iq_per_region = FOREACH total_iq_per_region
{
  GENERATE FLATTEN(group),
  SUM(A.iq) AS iq_per_region;
}

total_iq = FOREACH A
{
  GENERATE SUM(iq) AS total_iq:
}

Now I would like to retrieve the percentage of the region e.g. iq_per_reqion
/ total_iq and store the result. How can I achieve that? I hope my example
is not too confusing.

Cheers
-Marco

Reply via email to