日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

hadoop中job.setOutputFormatClass(PartitionByCoun...

發布時間:2023/12/15 编程问答 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 hadoop中job.setOutputFormatClass(PartitionByCoun... 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

2019獨角獸企業重金招聘Python工程師標準>>>

import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configured; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.*; import org.apache.hadoop.mapred.JobClient; import org.apache.hadoop.mapred.OutputCollector; import org.apache.hadoop.mapred.Reporter; import org.apache.hadoop.mapred.lib.MultipleTextOutputFormat; import org.apache.hadoop.mapreduce.*; import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; import org.apache.hadoop.mapreduce.lib.input.TextInputFormat; import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat; import org.apache.hadoop.util.Tool; import org.apache.hadoop.util.ToolRunner;public class MultiFile extends Configured {public static class MapClass extends Mapper<LongWritable, Text, NullWritable, Text> {public void map(LongWritable key, Text value,OutputCollector<NullWritable, Text> output,Reporter reporter) throws IOException {output.collect(NullWritable.get(), value);}}public static class PartitionByCountryMTOFextends MultipleTextOutputFormat<NullWritable,Text>{protected String generateFileNameForKeyValue(NullWritable key,Text value,String filename){String[] arr = value.toString().split(",", -1);String country = arr[4].substring(1,3);return country + "/" + filename;}}public static void main(String[] args) throws Exception { Configuration conf = new Configuration();Job job = new Job(conf, "MultiFile");job.setJarByClass(MultiFile.class);Path in = new Path(args[0]);Path out = new Path(args[1]);FileInputFormat.setInputPaths(job, in);//輸入路徑FileOutputFormat.setOutputPath(job, out);//輸出路徑job.setJobName("MultiFile");//job名稱job.setMapperClass(MapClass.class);job.setInputFormatClass(TextInputFormat.class);//輸入格式job.setOutputFormatClass(PartitionByCountryMTOF.class);//輸出格式設置job.setMapOutputValueClass(LongWritable.class);//job.setOutputKeyClass(NullWritable.class);輸出key的類型job.setOutputValueClass(Text.class);//輸出value的類型job.setNumReduceTasks(0);//設置reduce個數System.exit(job.waitForCompletion(true)?0:1);} }

job.setOutputFormatClass(PartitionByCountryMTOF.class);

顯示The method setOutputFormatClass(Class<? extends OutputFormat>) in the type Job is?

?not applicable for the arguments (Class<MultiFile.PartitionByCountryMTOF>)

請問怎么解決??

轉載于:https://my.oschina.net/u/242736/blog/83042

總結

以上是生活随笔為你收集整理的hadoop中job.setOutputFormatClass(PartitionByCoun...的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。