本文整理匯總了Java中org.apache.hadoop.fs.FileUtil.copyMerge方法的典型用法代碼示例。如果您正苦於以下問題:Java FileUtil.copyMerge方法的具體用法?Java FileUtil.copyMerge怎麽用?Java FileUtil.copyMerge使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.hadoop.fs.FileUtil
的用法示例。
在下文中一共展示了FileUtil.copyMerge方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: run
import org.apache.hadoop.fs.FileUtil; //導入方法依賴的package包/類
/**
*
* @return result - Frobenius Norm
* @throws IOException
* @throws ClassNotFoundException
* @throws InterruptedException
*/
public Double run() throws IOException, ClassNotFoundException, InterruptedException {
String wd = configuration.get("wd");
Path wdPath = new Path(wd);
Job job = Job.getInstance(configuration, "DF1");
Path tmpPath = new Path(configuration.get("wd"), "dftmp");
job.setJarByClass(MRNMF.class);
FileInputFormat.addInputPath(job, new Path(Xpath));
MatrixUpdater.addInpuPath(job, new Path(FGPath));
FileOutputFormat.setOutputPath(job, tmpPath);
job.setInputFormatClass(TextInputFormat.class);
job.setOutputFormatClass(TextOutputFormat.class);
job.setMapOutputKeyClass(LongWritable.class);
job.setMapOutputValueClass(Text.class);
job.setMapperClass(DFMapper1.class);
job.setReducerClass(DFReducer1.class);
job.waitForCompletion(true);
job = Job.getInstance(configuration, "DF2");
job.setJarByClass(MRNMF.class);
MatrixUpdater.addInpuPath(job, tmpPath);
FileOutputFormat.setOutputPath(job, new Path(wdPath, outputDir));
job.setInputFormatClass(TextInputFormat.class);
job.setOutputFormatClass(TextOutputFormat.class);
job.setMapOutputKeyClass(LongWritable.class);
job.setMapOutputValueClass(Text.class);
job.setMapperClass(DFMapper2.class);
job.setReducerClass(DFReducer2.class);
job.waitForCompletion(true);
FileSystem wdfs = wdPath.getFileSystem(new Configuration());
FileUtil.copyMerge(wdfs, new Path(wd, outputDir), wdfs, new Path(wd, resultFileName), false, new Configuration(), "");
return getResult(wdfs, new Path(wd, resultFileName));
}