[英]What are the types of <K,V> in InputSampler<K,V>?
I'm a newbie in Hadoop world. 我是Hadoop世界的新手。 I want to know what are the types of
<K,V>
in InputSampler<K,V>
or InputSampler.Sampler<K,V>
? 我想知道是什么类型的
<K,V>
中InputSampler<K,V>
或InputSampler.Sampler<K,V>
? This is equal to key and value coming out from Mapper
? 这等于从
Mapper
出来的键和值吗? The examples on Internet don't use them. Internet上的示例不使用它们。 For example this link just instantiate it without generics:
例如,此链接仅在没有泛型的情况下实例化它:
InputSampler.Sampler sampler = new InputSampler.RandomSampler(pcnt, numSamples, maxSplits);
Yes, when looking at the code , K denotes the type of the key, V denotes the value type. 是的, 在查看代码时 ,K表示键的类型,V表示值的类型。 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
. 真正的
Writable
类型取决于您要采样的输入类型,在这种意义上,它与您在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));
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.