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 valentina kroshilina <kr...@gmail.com> on 2010/01/22 20:21:41 UTC
casting in mapper
why can't I do something like this:
public void map(LongWritable longWritable, *ProviderIncidentWritable value*,
OutputCollector<IntWritable,* IncidentWritable*> outputCollector, Reporter
reporter) throws IOException
{
outputCollector.collect(new IntWritable(value.getId()), *value*);
}
where:
*public class ProviderIncidentWritable extends IncidentWritable*
I get error:
java.io.IOException: Type mismatch in value from map: expected
writable.IncidentWritable, recieved writable.ProviderIncidentWritable
at org.apache.hadoop.mapred.MapTask$MapOutputBuffer.collect(MapTask.java:812)
at org.apache.hadoop.mapred.MapTask$OldOutputCollector.collect(MapTask.java:466)
at mapper.ProviderAccountNonEmptyPrimaryInsuranceMapper.map(ProviderAccountNonEmptyPrimaryInsuranceMapper.java:31)
at mapper.ProviderAccountNonEmptyPrimaryInsuranceMapper.map(ProviderAccountNonEmptyPrimaryInsuranceMapper.java:25)
at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:50)
at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:358)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:307)
at org.apache.hadoop.mapred.Child.main(Child.java:170)
Is it just me doing something wrong, or is it not possible for some reason?
--
valentina kroshilina
Re: casting in mapper
Posted by valentina kroshilina <kr...@gmail.com>.
it's not the mapper, it's the setting
conf.setMapOutputValueClass(IncidentWritable.class);
that throws exception.
so
conf.setMapOutputValueClass(ProviderIncidentWritable.class);
fixes it.
On Fri, Jan 22, 2010 at 2:21 PM, valentina kroshilina
<kr...@gmail.com>wrote:
> why can't I do something like this:
>
> public void map(LongWritable longWritable, *ProviderIncidentWritable value
> *, OutputCollector<IntWritable,* IncidentWritable*> outputCollector,
> Reporter reporter) throws IOException
> {
> outputCollector.collect(new IntWritable(value.getId()), *value*);
> }
>
> where:
>
> *public class ProviderIncidentWritable extends IncidentWritable*
>
> I get error:
>
> java.io.IOException: Type mismatch in value from map: expected writable.IncidentWritable, recieved writable.ProviderIncidentWritable
>
>
>
> at org.apache.hadoop.mapred.MapTask$MapOutputBuffer.collect(MapTask.java:812)
> at org.apache.hadoop.mapred.MapTask$OldOutputCollector.collect(MapTask.java:466)
> at mapper.ProviderAccountNonEmptyPrimaryInsuranceMapper.map(ProviderAccountNonEmptyPrimaryInsuranceMapper.java:31)
>
>
>
> at mapper.ProviderAccountNonEmptyPrimaryInsuranceMapper.map(ProviderAccountNonEmptyPrimaryInsuranceMapper.java:25)
> at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:50)
> at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:358)
>
>
>
> at org.apache.hadoop.mapred.MapTask.run(MapTask.java:307)
> at org.apache.hadoop.mapred.Child.main(Child.java:170)
>
>
> Is it just me doing something wrong, or is it not possible for some reason?
>
> --
> valentina kroshilina
>
--
valentina kroshilina