Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Divison not working in Reducer

 
Debajyoti Kundu
Ranch Hand
Posts: 30
1
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm trying to get the inverse of aggregated value of each key in reducer.
Eg: for key-6, value-2.0,5.0,3.0 output of the reducer should be 6 0.1 . But in the output file i always get 6 10.

Following snippet describes my goal:

double=1/sum;
context.write(key, new DoubleWritable(temp));


Any help is appreciated
 
Rajesh Nagaraju
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Add a counter and check if the sum is correct in your reducer
 
Debajyoti Kundu
Ranch Hand
Posts: 30
1
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rajesh,
The sum is correct. There is no issue with floating point addition. I'm working with integers converted into floating point values. Therefore the addition order issue of floating point is not applicable for this particular scenario. Any kind of division is showing abnormal behaviour.


Eg: 1.0/sum is yeilding only sum. If I do sum/2.0 I'm not getting half of the sum
 
Debajyoti Kundu
Ranch Hand
Posts: 30
1
Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Issue is resolved. If anyone have similar problem, please check your Hadoop job configuration. I was using WordCount program template in my program. In that program there was Combiner class setup was specified. Due to that statement I got erroneous output. I commented that line and got correct output.
 
J. Kevin Robbins
Bartender
Pie
Posts: 1801
28
Chrome Eclipse IDE Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for coming back with the solution. That's helpful to others in the future. I'm giving you a cow for that.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic