我有一个仅映射的作业和自定义OutputFormat,它扩展了FileOutputFormat,并希望使用与输入相同的名称(或稍作修改)来编写输出文件。因此,我需要在我的自定义RecordWriter中获取文件名。我知道这可以通过以下代码在Mapper中实现:
FileSplit fileSplit = (FileSplit)context.getInputSplit();
String filename = fileSplit.getPath().getName();但是不知道如何将文件名从映射器传递到我的RecordWriter。
发布于 2015-12-04 20:23:01
您需要按照here的说明使用MultipleOutputFormat
您需要使用上下文/配置对象将所需的字符串文件名从映射器传递到reducer。
https://stackoverflow.com/questions/34088142
复制相似问题