Java Code Examples for org.apache.tez.dag.api.TezConfiguration#setClass()
The following examples show how to use
org.apache.tez.dag.api.TezConfiguration#setClass() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestMRCombiner.java From tez with Apache License 2.0 | 6 votes |
@Test public void testRunOldCombiner() throws IOException, InterruptedException { TezConfiguration conf = new TezConfiguration(); setKeyAndValueClassTypes(conf); conf.setClass("mapred.combiner.class", OldReducer.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(3, outputRecords); // verify combiner output keys and values verifyKeyAndValues(writer); }
Example 2
Source File: TestMRCombiner.java From tez with Apache License 2.0 | 6 votes |
@Test public void testRunNewCombiner() throws IOException, InterruptedException { TezConfiguration conf = new TezConfiguration(); setKeyAndValueClassTypes(conf); conf.setBoolean("mapred.mapper.new-api", true); conf.setClass(MRJobConfig.COMBINE_CLASS_ATTR, NewReducer.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(3, outputRecords); // verify combiner output keys and values verifyKeyAndValues(writer); }
Example 3
Source File: TestMRCombiner.java From tez with Apache License 2.0 | 6 votes |
@Test public void testTop2RunNewCombiner() throws IOException, InterruptedException { TezConfiguration conf = new TezConfiguration(); setKeyAndValueClassTypes(conf); conf.setBoolean("mapred.mapper.new-api", true); conf.setClass(MRJobConfig.COMBINE_CLASS_ATTR, Top2NewReducer.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); }
Example 4
Source File: TestMRCombiner.java From tez with Apache License 2.0 | 5 votes |
@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); }
Example 5
Source File: TestMRCombiner.java From tez with Apache License 2.0 | 4 votes |
private void setKeyAndValueClassTypes(TezConfiguration conf) { conf.setClass(TezRuntimeConfiguration.TEZ_RUNTIME_KEY_CLASS, Text.class, Object.class); conf.setClass(TezRuntimeConfiguration.TEZ_RUNTIME_VALUE_CLASS, IntWritable.class, Object.class); }