You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by Jonathan Holloway <jo...@gmail.com> on 2011/03/16 23:50:02 UTC
Percentage Calculation for Two Data Groups
Hi,
Given the following:
Group 1 - Tests Totals:
(A, 4)
(B, 30)
(C, 40)
(D, 30)
Group 2 - Tests Passed:
(A,1)
(B,30)
How would I calculate the percentage of Group 2 / Group 1 using Pig? I'm
assuming one way is to join on the the two datasets and calculate the
percentage that way. Another way is to use a custom UDF. Is there a better
way than either of these?
Many thanks,
Jon.
Re: Percentage Calculation for Two Data Groups
Posted by Dmitriy Ryaboy <dv...@gmail.com>.
Hi Jonathan,
Join seems like the obvious thing to do.. I am guessing you are asking cause
you don't like it for some reason? What's the concern, speed?
D
On Wed, Mar 16, 2011 at 3:50 PM, Jonathan Holloway <
jonathan.holloway@gmail.com> wrote:
> Hi,
>
> Given the following:
>
> Group 1 - Tests Totals:
> (A, 4)
> (B, 30)
> (C, 40)
> (D, 30)
>
> Group 2 - Tests Passed:
> (A,1)
> (B,30)
>
> How would I calculate the percentage of Group 2 / Group 1 using Pig? I'm
> assuming one way is to join on the the two datasets and calculate the
> percentage that way. Another way is to use a custom UDF. Is there a
> better
> way than either of these?
>
> Many thanks,
> Jon.
>