如何映射整个文本文档而不是逐行映射?

时间:2019-05-17 02:07:31

标签: java mapreduce bigdata

我有一个Java Map / Reduce作业,该作业在大块文本上运行并执行正则表达式。当前,该代码一次返回一行文本并对其进行处理:

public class MetricsMapper extends Mapper<LongWritable, Text, Text, Text> {
                @Override
                public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
                                String line = value.toString();
                           ...process the line...

我想只在整个文档上而不是一行上运行代码。我担心我寻找的某些短语可能在行之间被打乱。 如何一次处理整个文档?

0 个答案:

没有答案
相关问题