开发者

How to pull data in the Map/Reduce functions?

According to the Hadoop : The Definitive Guide.

The new API supports both a “push” and a “pull” style of iteration. In both APIs, key-value record pairs are pushed to the mapper, but i开发者_Go百科n addition, the new API allows a mapper to pull records from within the map() method. The same goes for the reducer. An example of how the “pull” style can be useful is processing records in batches, rather than one by one.

Has anyone pulled data in the Map/Reduce functions? I am interested in the API or example for the same.


I posted a query @ mapreduce-user@hadoop.apache.org and got the answer.

The next key value pair can be retrieved from the context object which is passed to the map, by calling nextKeyValue() on it. So you will be able to pull the next data from it in the new API.

Is the performance of pull better than push in this scenario? Also, what are the scenarios in which the pull will be useful?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜