Reputation: 5745
I'm a newbie in Hadoop world. I want to know what are the types of <K,V>
in InputSampler<K,V>
or InputSampler.Sampler<K,V>
? This is equal to key and value coming out from Mapper
? The examples on
Internet don't use them. For example this link just instantiate it without generics:
InputSampler.Sampler sampler = new InputSampler.RandomSampler(pcnt, numSamples, maxSplits);
Upvotes: 0
Views: 89
Reputation: 20969
Yes, when looking at the code, K denotes the type of the key, V denotes the value type. The real Writable
type depends on what kind of input you want to sample, in that sense- yes it is similar to what you would use in a Mapper
.
RecordReader<K,V> reader = inf.createRecordReader(splits.get(i), samplingContext);
reader.initialize(splits.get(i), samplingContext);
while (reader.nextKeyValue()) {
samples.add(ReflectionUtils.copy(job.getConfiguration(),
reader.getCurrentKey(), null));
}
Upvotes: 1