gpt4 book ai didi

java - 在hadoop mapreduce中读取2个输入文件

转载 作者:行者123 更新时间:2023-12-02 21:38:59 25 4
gpt4 key购买 nike

我需要读取2个不同的输入文件并写入2个输出文件。第一个文件是主输入文件,第二个是字典。我的工作应该在mapper和reducers中同时处理两个文件。据我了解,我不能使用多输入。我尝试使用BufferedReader和BufferedWriter。但是后来我在mapper中创建了另一个作业,在reducer中创建了另一个作业。我该如何解决问题?

最佳答案

您可以使用多个文件输入,请引用http://hadoop.apache.org/docs/stable/api/org/apache/hadoop/mapred/lib/MultipleInputs.html

MultipleInputs.addInputPath(job, inputPath1, TextInputFormat.class, MyMapper.class);
MultipleInputs.addInputPath(job, inputPath2, TextInputFormat.class, MyMapper.class);

inputPath1,inputPath2中可以有多个文件。

关于java - 在hadoop mapreduce中读取2个输入文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30110296/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com