Retrieving the most frequently occurring value in PIG
If I have the following data set:

    c1   c2
    ---  ---
    1    5
    1    5
    1    6
    2    9
    2    9
    3    1
    3    2

I want to return the most frequently occurring value in the second column (c2) for each value in the first column (c1).  So  I would want the returning data set to look like the following since for c1=1 the value "5" occurs twice and the value "6" only occurs once and for c1=2, the value of "9" occurs twice and no other value occurs:

    1    5
    2    9
    3    1

The case I am having problems with is where there is an equal number of occurrences (in this case where c1=3.)  In the case (c1=3) where there is an equal number of occurring values in c2 then I just want the first occurrence returned.  

Any ideas would be helpful.

Retrieving the most frequently occurring value in PIG
===

If I have the following data set:

    c1   c2
    ---  ---
    1    5
    1    5
    1    6
    2    9
    2    9
    3    1
    3    2

I want to return the most frequently occurring value in the second column (c2) for each value in the first column (c1).  So  I would want the returning data set to look like the following since for c1=1 the value "5" occurs twice and the value "6" only occurs once and for c1=2, the value of "9" occurs twice and no other value occurs:

    1    5
    2    9
    3    1

The case I am having problems with is where there is an equal number of occurrences (in this case where c1=3.)  In the case (c1=3) where there is an equal number of occurring values in c2 then I just want the first occurrence returned.  

Any ideas would be helpful.
