You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-user@hadoop.apache.org by Khanh Nguyen <kn...@cs.umb.edu> on 2008/07/21 19:25:58 UTC
type mismatch from key to map
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
Re: type mismatch from key to map
Posted by Khanh Nguyen <kn...@cs.umb.edu>.
Nevermind, I figured out my problem. I did not configure OutputFormat.
On Mon, Jul 21, 2008 at 1:44 PM, Khanh Nguyen <kn...@cs.umb.edu> 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 <d4...@gmail.com> 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 <kn...@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
>>>
>>
>
Re: type mismatch from key to map
Posted by Khanh Nguyen <kn...@cs.umb.edu>.
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 <d4...@gmail.com> 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 <kn...@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
>>
>
Re: type mismatch from key to map
Posted by Daniel Yu <d4...@gmail.com>.
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 <kn...@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
>