• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Divison not working in Reducer

 
Ranch Hand
Posts: 33
1
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Add a counter and check if the sum is correct in your reducer
 
Debajyoti Kundu
Ranch Hand
Posts: 33
1
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 33
1
Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 1810
28
jQuery Netbeans IDE Eclipse IDE Firefox Browser MySQL Database Chrome Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic