use of org.apache.tez.runtime.library.common.shuffle.LocalDiskFetchedInput in project tez by apache.
the class TestUnorderedKVReader method setupReader.
private void setupReader() throws IOException, InterruptedException {
defaultConf.set(TezRuntimeConfiguration.TEZ_RUNTIME_KEY_CLASS, Text.class.getName());
defaultConf.set(TezRuntimeConfiguration.TEZ_RUNTIME_VALUE_CLASS, Text.class.getName());
createIFile(outputPath, 1);
final LinkedList<LocalDiskFetchedInput> inputs = new LinkedList<LocalDiskFetchedInput>();
LocalDiskFetchedInput realFetchedInput = new LocalDiskFetchedInput(0, compLen, new InputAttemptIdentifier(0, 0), outputPath, defaultConf, new FetchedInputCallback() {
@Override
public void fetchComplete(FetchedInput fetchedInput) {
}
@Override
public void fetchFailed(FetchedInput fetchedInput) {
}
@Override
public void freeResources(FetchedInput fetchedInput) {
}
});
LocalDiskFetchedInput fetchedInput = spy(realFetchedInput);
doNothing().when(fetchedInput).free();
inputs.add(fetchedInput);
TezCounters counters = new TezCounters();
TezCounter inputRecords = counters.findCounter(TaskCounter.INPUT_RECORDS_PROCESSED);
ShuffleManager manager = mock(ShuffleManager.class);
doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocationOnMock) throws Throwable {
return (inputs.isEmpty()) ? null : inputs.remove();
}
}).when(manager).getNextInput();
unorderedKVReader = new UnorderedKVReader<Text, Text>(manager, defaultConf, null, false, -1, -1, inputRecords, mock(InputContext.class));
}
Aggregations