本文介绍了map-reduce 是否可以有多个输出文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的输入文件中,我有一列作为国家/地区.现在,我的任务是将特定国家的记录放入以该国家命名的单独文件中.这可以在 Map-reduce 中做到吗?!请分享您对此的想法.

In my input file i have a column as country. Now, my task is to place records of a particular country into a separate file naming with that country. Is this possible to do in Map-reduce.!Please share your ideas regarding this.

推荐答案

是的,在 hadoop 中你可以使用 MultipleOutputFormat 使用它的 generateFileNameForKeyValue 方法.

Yes it is, in hadoop you can use MultipleOutputFormat to do exactly that, using its generateFileNameForKeyValue method.

使用您的国家名称作为键和记录作为值,这应该完全符合您的需要.

Using your country names as keys and the records as values this should work exactly as you need it to.

这篇关于map-reduce 是否可以有多个输出文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-29 03:19
查看更多