[ 
https://issues.apache.org/jira/browse/MRUNIT-131?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13428688#comment-13428688
 ] 

Dave Beech commented on MRUNIT-131:
-----------------------------------

Committed a fix in 1369483. 

As a side-effect of the change, the testJavaSerialization tests began to fail 
with this error:
java.lang.ClassCastException: class java.lang.Integer
        at java.lang.Class.asSubclass(Class.java:3018)
        at 
org.apache.hadoop.mapred.JobConf.getOutputKeyComparator(JobConf.java:795)

This is because Integer is not a subclass of WritableComparable, which it would 
need to be in order to use the default WritableComparator. When using Integer 
(or regular java classes) as keys, you need to specify the comparator 
JavaSerializationComparator explicitly. Adding this fixed the tests. I also 
confirmed that this error would occur in a real mapreduce job without the 
comparator set.  
                
> Comparators registered using WritableComparator.define are not used during 
> tests
> --------------------------------------------------------------------------------
>
>                 Key: MRUNIT-131
>                 URL: https://issues.apache.org/jira/browse/MRUNIT-131
>             Project: MRUnit
>          Issue Type: Bug
>    Affects Versions: 0.9.0
>            Reporter: Dave Beech
>            Assignee: Dave Beech
>             Fix For: 1.0.0
>
>
> The comparator to use for sorting map outputs can be set in Hadoop using 
> WritableComparator.define(MyWritable.class, new MyComparator());
> However these comparators are not recognised by MRUnit and are not used by 
> MapReduceDriver tests. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to