NodeDumper.java 文件源码

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

项目:GeoCrawler 作者:
/**
 * Outputs either the sum or the top value for this record.
 */
public void reduce(Text key, Iterator<FloatWritable> values,
    OutputCollector<Text, FloatWritable> output, Reporter reporter)
    throws IOException {

  long numCollected = 0;
  float sumOrMax = 0;
  float val = 0;

  // collect all values, this time with the url as key
  while (values.hasNext() && (numCollected < topn)) {
    val = values.next().get();

    if (sum) {
      sumOrMax += val;
    } else {
      if (sumOrMax < val) {
        sumOrMax = val;
      }
    }

    numCollected++;
  }

  output.collect(key, new FloatWritable(sumOrMax));
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号