Hi
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);
else
// g.P ==1
A2.add(g);
}
// now having captured the points as in the type g I want to do some
calculation to find the intersection
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?
Thanks
Ranjan