KSamplerMapReduce.java 文件源码

java
阅读 27 收藏 0 点赞 0 评论 0

项目:geowave 作者:
@Override
protected void mapNativeValue(
        final GeoWaveInputKey key,
        final Object value,
        final org.apache.hadoop.mapreduce.Mapper<GeoWaveInputKey, ObjectWritable, GeoWaveInputKey, ObjectWritable>.Context context )
        throws IOException,
        InterruptedException {
    @SuppressWarnings("unchecked")
    final double rank = samplingFunction.rank(
            sampleSize,
            (T) value);
    if (rank > 0.0000000001) {
        final AnalyticItemWrapper<Object> wrapper = itemWrapperFactory.create(value);
        outputKey.setDataId(new ByteArrayId(
                keyManager.putData(
                        nestedGroupCentroidAssigner.getGroupForLevel(wrapper),
                        1.0 - rank, // sorts in ascending order
                        key.getDataId().getBytes())));
        outputKey.setAdapterId(key.getAdapterId());
        outputKey.setInsertionId(key.getInsertionId());
        context.write(
                outputKey,
                currentValue);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号