早晨写了个关于专利数目统计的MapReduce程序,运行后发现:
错误上说Map函数的Key类型与设置的不一样,仔细一查发现
原来job.setOutputKeyClass和job.setOutputValueClass默认情况下同时设置Map和Reduce的输出,如果Map和Reduce设置的输出类型不相同就是报错,这时候就需要用到专门设置Map的job.setMapOutputKeyClass和job.setMapOutputValueClass,添加上后,运行正确。
早晨写了个关于专利数目统计的MapReduce程序,运行后发现:
错误上说Map函数的Key类型与设置的不一样,仔细一查发现
原来job.setOutputKeyClass和job.setOutputValueClass默认情况下同时设置Map和Reduce的输出,如果Map和Reduce设置的输出类型不相同就是报错,这时候就需要用到专门设置Map的job.setMapOutputKeyClass和job.setMapOutputValueClass,添加上后,运行正确。