You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-user@hadoop.apache.org by Ranjan Sen <ra...@hotmail.com> on 2010/12/04 18:50:37 UTC

while loop issue in reduce

Hi 
 
I want to copy the values from the key and Iterator of value input in a reduce function. I was using a ArrayList to copy the list content into. I was using a 
while(values.haveNext()) {
a_el=values.next();
}
 
My input is supposed to have only one key into the reduce with around 625 value elements in the list. I do get the value elements copied but I have all of them with the value of the last element in them. 
 
I think the reduce process processing the list but at the termination of the while loop it is doing something I cannot understand. 
 
Any suggestions?
 
Thanks a lot
 
Ranjan 		 	   		  

RE: while loop issue in reduce

Posted by Ranjan Sen <ra...@hotmail.com>.




Hi 
 
I want to copy the values from the key and Iterator of value input in a reduce function. I was using a ArrayList to copy the list content into. I was using a 
while(values.haveNext()) {
a_el=values.next();
}
 
My input is supposed to have only one key into the reduce with around 625 value elements in the list. I do get the value elements copied but I have all of them with the value of the last element in them. 
 
I think the reduce process processing the list but at the termination of the while loop it is doing something I cannot understand. 
 
I am using version 0.21.0.
 
Any suggestions?
 
Thanks a lot
 
Ranjan
 		 	   		  

Re: while loop issue in reduce

Posted by Ted Yu <yu...@gmail.com>.
Is a_el an ArrayList ?
If not, you only get the last element's value.

On Sat, Dec 4, 2010 at 9:50 AM, Ranjan Sen <ra...@hotmail.com> wrote:

>
> Hi
>
> I want to copy the values from the key and Iterator of value input in a
> reduce function. I was using a ArrayList to copy the list content into. I
> was using a
> while(values.haveNext()) {
> a_el=values.next();
> }
>
> My input is supposed to have only one key into the reduce with around 625
> value elements in the list. I do get the value elements copied but I have
> all of them with the value of the last element in them.
>
> I think the reduce process processing the list but at the termination of
> the while loop it is doing something I cannot understand.
>
> Any suggestions?
>
> Thanks a lot
>
> Ranjan