【发布时间】:2015-10-06 12:36:20
【问题描述】:
在hadoop的WordCount任务中,如何获取token word的文件名并在context.write(new Test(filename), one)中使用?
【问题讨论】:
标签: java apache hadoop mapreduce
在hadoop的WordCount任务中,如何获取token word的文件名并在context.write(new Test(filename), one)中使用?
【问题讨论】:
标签: java apache hadoop mapreduce
可以在 Mapper 类中使用以下代码 sn-p 检索文件名。
FileSplit fileSplit = (FileSplit)context.getInputSplit();
String filename = fileSplit.getPath().getName();
【讨论】: