FAQ
Hello,

I am getting this error

java.io.IOException: Type mismatch in key from map: expected
org.apache.hadoop.io.LongWritable, recieved org.apache.hadoop.io.Text


Could someone please explain to me what i am doing wrong. Follow is
the code I think is responsible...

public int run() {
.....

sortJob.setInputFormat(KeyValueTextInputFormat.class);

sortJob.setMapperClass(InverseMapper.class);
....

}

Thanks

-k

Search Discussions

  • Daniel Yu at Jul 21, 2008 at 5:31 pm
    hi k,
    i think u should look at ur map output format setting, and check if that
    fits ur reduce input .

    Daniel

    2008/7/21 Khanh Nguyen <knguyen@cs.umb.edu>:
    Hello,

    I am getting this error

    java.io.IOException: Type mismatch in key from map: expected
    org.apache.hadoop.io.LongWritable, recieved org.apache.hadoop.io.Text


    Could someone please explain to me what i am doing wrong. Follow is
    the code I think is responsible...

    public int run() {
    .....

    sortJob.setInputFormat(KeyValueTextInputFormat.class);

    sortJob.setMapperClass(InverseMapper.class);
    ....

    }

    Thanks

    -k
  • Khanh Nguyen at Jul 21, 2008 at 5:45 pm
    Hi Daniel,

    The outputformat of my 1st hadoop job is TextOutputFormat. The
    skeleton of my code follows:

    public int run(String[] args) throws Exception {
    //set up and run job 1
    ...
    conf.setOutputFormat(TextOutputFormat.class);
    FileOutputFormat.setOutputPath(conf, new Path(args[1]));

    ....
    //set up and run job 2
    .......
    FileInputFormat.addInputPath(sortJob, new Path(args[1] +
    "/part-00000"));
    FileOutputFormat.setOutputPath(sortJob, new Path(args[1]
    + "/result/"));
    sortJob.setInputFormat(KeyValueTextInputFormat.class);
    sortJob.setMapperClass(InverseMapper.class)
    ......

    }

    Please help.

    -k
    On Mon, Jul 21, 2008 at 1:30 PM, Daniel Yu wrote:
    hi k,
    i think u should look at ur map output format setting, and check if that
    fits ur reduce input .

    Daniel

    2008/7/21 Khanh Nguyen <knguyen@cs.umb.edu>:
    Hello,

    I am getting this error

    java.io.IOException: Type mismatch in key from map: expected
    org.apache.hadoop.io.LongWritable, recieved org.apache.hadoop.io.Text


    Could someone please explain to me what i am doing wrong. Follow is
    the code I think is responsible...

    public int run() {
    .....

    sortJob.setInputFormat(KeyValueTextInputFormat.class);

    sortJob.setMapperClass(InverseMapper.class);
    ....

    }

    Thanks

    -k
  • Khanh Nguyen at Jul 21, 2008 at 6:32 pm
    Nevermind, I figured out my problem. I did not configure OutputFormat.
    On Mon, Jul 21, 2008 at 1:44 PM, Khanh Nguyen wrote:
    Hi Daniel,

    The outputformat of my 1st hadoop job is TextOutputFormat. The
    skeleton of my code follows:

    public int run(String[] args) throws Exception {
    //set up and run job 1
    ...
    conf.setOutputFormat(TextOutputFormat.class);
    FileOutputFormat.setOutputPath(conf, new Path(args[1]));

    ....
    //set up and run job 2
    .......
    FileInputFormat.addInputPath(sortJob, new Path(args[1] +
    "/part-00000"));
    FileOutputFormat.setOutputPath(sortJob, new Path(args[1]
    + "/result/"));
    sortJob.setInputFormat(KeyValueTextInputFormat.class);
    sortJob.setMapperClass(InverseMapper.class)
    ......

    }

    Please help.

    -k
    On Mon, Jul 21, 2008 at 1:30 PM, Daniel Yu wrote:
    hi k,
    i think u should look at ur map output format setting, and check if that
    fits ur reduce input .

    Daniel

    2008/7/21 Khanh Nguyen <knguyen@cs.umb.edu>:
    Hello,

    I am getting this error

    java.io.IOException: Type mismatch in key from map: expected
    org.apache.hadoop.io.LongWritable, recieved org.apache.hadoop.io.Text


    Could someone please explain to me what i am doing wrong. Follow is
    the code I think is responsible...

    public int run() {
    .....

    sortJob.setInputFormat(KeyValueTextInputFormat.class);

    sortJob.setMapperClass(InverseMapper.class);
    ....

    }

    Thanks

    -k

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcommon-user @
categorieshadoop
postedJul 21, '08 at 5:26p
activeJul 21, '08 at 6:32p
posts4
users2
websitehadoop.apache.org...
irc#hadoop

2 users in discussion

Khanh Nguyen: 3 posts Daniel Yu: 1 post

People

Translate

site design / logo © 2022 Grokbase