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

Patrick Hunt commented on MRUNIT-166:
-------------------------------------

Hi Dave. I ran it in the debugger and it was failing in 
org.apache.hadoop.mapreduce.ID.equals(Object) on this line:

    if (o.getClass() == this.getClass()) {

(well not failing, but the conditional was false and as a result return false 
out of that method)

This check is prior to any other checking, such as the actual ids themselves. 
Which is probably why I didn't notice the issue you highlighted.

fwiw I got around this problem by overriding the binding on the context myself 
and providing my own taskid using mapred package (so the eventual equals check 
would pass). I used values for the taskid that would allow the test to pass 
(i.e. the same values for id, etc..., in both cases). However I'd like to 
remove my hack if at all possible.

Thanks.
                
> mapreduce reducers are passed mapred taskattemptid/taskid class instances
> -------------------------------------------------------------------------
>
>                 Key: MRUNIT-166
>                 URL: https://issues.apache.org/jira/browse/MRUNIT-166
>             Project: MRUnit
>          Issue Type: Bug
>    Affects Versions: 1.0.0
>            Reporter: Patrick Hunt
>
> I have a mapreduce API based reducer. When my test runs the setup method is 
> called with a mapred taskattemptid/taskid. You can see it in the following. 
> I'm printing the classes of the passed context, taskattemptid, taskid. You 
> can see that my reducer is getting called through mapreduce.Reduce.run().
> {noformat}
> PDH setup context:class 
> org.apache.hadoop.mapreduce.Reducer$Context$$EnhancerByMockitoWithCGLIB$$fc977043
> PDH setup taskattemptid:class org.apache.hadoop.mapred.TaskAttemptID
> PDH setup taskid:class org.apache.hadoop.mapred.TaskID
> PDH setup stack:
>       at foo.FooReducerTest$MyFooReducer.setup(FooReducerTest.java:75)
>       at org.apache.hadoop.mapreduce.Reducer.run(Reducer.java:162)
>       at 
> org.apache.hadoop.mrunit.mapreduce.ReduceDriver.run(ReduceDriver.java:139)
>       at foo.FooReducerTest.testReducer(FooReducerTest.java:120)
> {noformat}
> this causes my tests to fail due to later invocations of the test are also 
> exercising a subclass of FileOutputFormat, specifically the method
> org.apache.hadoop.mapreduce.lib.output.FileOutputFormat.getRecordWriter(TaskAttemptContext)
> getRecordWriter is called with a context that provides mapreduce based 
> taskattemptid/taskid.
> The code is comparing the taskid of setup to getRecordWriter, which fails due 
> to the classes being different (even though the data, taskid, itself is the 
> same)

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to