开发者社区 问答 正文

MapReduce中编写Mapper类编程规范有哪些?

MapReduce中编写Mapper类编程规范有哪些?

展开
收起
游客daliwbfb2wo66 2021-12-04 21:16:28 399 分享 版权
1 条回答
写回答
取消 提交回答
  • 1.继承org.apache.hadoop.mapreduce.Mapper类

    2.设置mapper类的输入类型<LongWritable, Text>

    3.设置mapper类的输出类型<Text, IntWritable>

    4.将输入类型中的Text转换成String类型,并按照指定分隔符进行分割

    5.通过context.write()方法进行输出

    2021-12-04 21:16:55
    赞同 展开评论