hadoop-mapreduce-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sen, Ranjan" <r...@udc.edu>
Subject question
Date Mon, 22 Nov 2010 22:13:46 GMT
I am new to Hadoop. I will highly appreciate your help. I have the following scenario:

I have key, values received by the reduce function - where the values are points on two circles.
I am trying to reduce these into two output records in which I will have the two points in
which the two circle intersect if they does or a special value if one is contained in the
other. As I go over the list of values (which are the points on the two circles) I wanted
to capture the points in to an arrayList and after scanning find the intersection information.
I have a code structure as follows:

Reduce  (key, Iterator values...) {
A1 is ArrayList of type g
A2 is ArrayList of type g

g_instance is an instance of type g
While (values.hasNext()) {
                g = values.getNext();
                if (g.P == 0) A1.add(g);
                // g.P ==1

// now having captured the points as in the type g I want to do some calculation to find the
                for(int i=0; i < A1.size(); i++) {
                                temp_g1 = A1.get(i);
                                for(int j=0; j< A2.size(); j++) {
                                temp_g2 = A2.get(j);
                                // compare the x and y of the points represented by temp_g1
and temp_g2
                                //Find the one that is min distance apart
                                // store the index of the points

// now send the points in the output
Output.collect (key, new gvalue(...))

} // end of reduce

I can get the g values in the while loop but after I am out of that my arrays have size zero

Is there something I missed in my design?



  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message