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

Facing issue in running mapreduce program

 
aziz uddin
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
i am trying to write a custom word count program but i am getting an error saying "Error: java.io.IOException: Type mismatch in key from map: expected org.apache.hadoop.io.IntWritable, received org.apache.hadoop.io.LongWritable" where as you can see i have not used LongWritable anywhere in the program. please guide to resolve this issue and correct where i went wrong.

Mapreduce code :


input file:
you can consider any statement as input to this program.
 
Karthik Shiraly
Bartender
Posts: 1210
25
Android C++ Java Linux PHP Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to CodeRanch!

TextInputFormat outputs pairs of (LongWritable position, Text line).
Keys are file positions, values are the input lines.
And your mapper outputs pairs of (Text word, IntWritable count).

So your Mapper class declaration should have the correct order of keys and value classes, and map() method's arguments should have the correct types:


The Reducer looks ok.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic