Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Divison not working in Reducer

 
Ranch Hand
Posts: 33
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
 
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: 33
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: 33
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.
 
Bartender
Posts: 1810
28
jQuery Netbeans IDE Eclipse IDE Firefox Browser MySQL Database Chrome Linux
  • 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.
 
All of life is a contant education - Eleanor Roosevelt. Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic