Search in sources :

Example 6 with TaskContext

use of org.apache.tez.runtime.api.TaskContext in project tez by apache.

the class TestMRCombiner method testTop2RunOldCombiner.

@Test
public void testTop2RunOldCombiner() throws IOException, InterruptedException {
    TezConfiguration conf = new TezConfiguration();
    setKeyAndValueClassTypes(conf);
    conf.setClass("mapred.combiner.class", Top2OldReducer.class, Object.class);
    TaskContext taskContext = getTaskContext(conf);
    MRCombiner combiner = new MRCombiner(taskContext);
    Writer writer = Mockito.mock(Writer.class);
    combiner.combine(new TezRawKeyValueIteratorTest(), writer);
    long inputRecords = taskContext.getCounters().findCounter(TaskCounter.COMBINE_INPUT_RECORDS).getValue();
    long outputRecords = taskContext.getCounters().findCounter(TaskCounter.COMBINE_OUTPUT_RECORDS).getValue();
    assertEquals(6, inputRecords);
    assertEquals(5, outputRecords);
}
Also used : TaskContext(org.apache.tez.runtime.api.TaskContext) Writer(org.apache.tez.runtime.library.common.sort.impl.IFile.Writer) TezConfiguration(org.apache.tez.dag.api.TezConfiguration) Test(org.junit.Test)

Aggregations

TaskContext (org.apache.tez.runtime.api.TaskContext)6 TezConfiguration (org.apache.tez.dag.api.TezConfiguration)4 Writer (org.apache.tez.runtime.library.common.sort.impl.IFile.Writer)4 Test (org.junit.Test)4 IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 TezCounters (org.apache.tez.common.counters.TezCounters)1 UserPayload (org.apache.tez.dag.api.UserPayload)1 Combiner (org.apache.tez.runtime.library.common.combine.Combiner)1