MapReduce连接-厦门大学数据库室.pptVIP

  • 3
  • 0
  • 约1.5万字
  • 约 45页
  • 2019-10-20 发布于天津
  • 举报
GenericReplicatedJoin(续) 以下代码为GenericReplicatedJoin中的Map方法。它将会根据setup方法是否将了分布式缓存的内容装载到内存的缓存中来选择行为。如果分布式缓存的内容被装载到内存中,那么map方法就将输入块的记录和内存中的缓存做连接操作。如果分布式缓存的内容没有被装载到内存中,那么map方法就将输入块的记录装载到内存中,然后在cleanup方法中使用。 protected void map(Object key, Object value, Context context) throws IOException, InterruptedException { Pair pair = readFromInputFormat(key, value); if(distributedCacheIsSmaller) { joinAndCollect(pair, context); } else { addToCache(pair);}} public void joinAndCollect(Pair p, Context context) throws IOException, InterruptedException { ListPair cached = cachedRecords.get(p.getKey());

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档