本文整理汇总了Java中org.apache.hadoop.mapred.lib.NullOutputFormat类的典型用法代码示例。如果您正苦于以下问题:Java NullOutputFormat类的具体用法?Java NullOutputFormat怎么用?Java NullOutputFormat使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NullOutputFormat类属于org.apache.hadoop.mapred.lib包,在下文中一共展示了NullOutputFormat类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testInputFormat
import org.apache.hadoop.mapred.lib.NullOutputFormat; //导入依赖的package包/类
void testInputFormat(Class<? extends InputFormat> clazz) throws IOException {
final JobConf job = MapreduceTestingShim.getJobConf(mrCluster);
job.setInputFormat(clazz);
job.setOutputFormat(NullOutputFormat.class);
job.setMapperClass(ExampleVerifier.class);
job.setNumReduceTasks(0);
LOG.debug("submitting job.");
final RunningJob run = JobClient.runJob(job);
assertTrue("job failed!", run.isSuccessful());
assertEquals("Saw the wrong number of instances of the filtered-for row.", 2, run.getCounters()
.findCounter(TestTableInputFormat.class.getName() + ":row", "aaa").getCounter());
assertEquals("Saw any instances of the filtered out row.", 0, run.getCounters()
.findCounter(TestTableInputFormat.class.getName() + ":row", "bbb").getCounter());
assertEquals("Saw the wrong number of instances of columnA.", 1, run.getCounters()
.findCounter(TestTableInputFormat.class.getName() + ":family", "columnA").getCounter());
assertEquals("Saw the wrong number of instances of columnB.", 1, run.getCounters()
.findCounter(TestTableInputFormat.class.getName() + ":family", "columnB").getCounter());
assertEquals("Saw the wrong count of values for the filtered-for row.", 2, run.getCounters()
.findCounter(TestTableInputFormat.class.getName() + ":value", "value aaa").getCounter());
assertEquals("Saw the wrong count of values for the filtered-out row.", 0, run.getCounters()
.findCounter(TestTableInputFormat.class.getName() + ":value", "value bbb").getCounter());
}
示例2: setupJobConf
import org.apache.hadoop.mapred.lib.NullOutputFormat; //导入依赖的package包/类
public JobConf setupJobConf(int numMapper, int numReducer,
long mapSleepTime, int mapSleepCount,
long reduceSleepTime, int reduceSleepCount) {
JobConf job = new JobConf(getConf(), SleepJob.class);
job.setNumMapTasks(numMapper);
job.setNumReduceTasks(numReducer);
job.setMapperClass(SleepJob.class);
job.setMapOutputKeyClass(IntWritable.class);
job.setMapOutputValueClass(NullWritable.class);
job.setReducerClass(SleepJob.class);
job.setOutputFormat(NullOutputFormat.class);
job.setInputFormat(SleepInputFormat.class);
job.setPartitionerClass(SleepJob.class);
job.setSpeculativeExecution(false);
job.setJobName("Sleep job");
FileInputFormat.addInputPath(job, new Path("ignored"));
job.setLong("sleep.job.map.sleep.time", mapSleepTime);
job.setLong("sleep.job.reduce.sleep.time", reduceSleepTime);
job.setInt("sleep.job.map.sleep.count", mapSleepCount);
job.setInt("sleep.job.reduce.sleep.count", reduceSleepCount);
return job;
}
示例3: configure
import org.apache.hadoop.mapred.lib.NullOutputFormat; //导入依赖的package包/类
public void configure(JobConf job) {
// Set the mapper and reducers
job.setMapperClass(ReadDataJob.TestMapper.class);
// Make sure this jar is included
job.setJarByClass(ReadDataJob.TestMapper.class);
// Specify the input and output data formats
job.setInputFormat(TextInputFormat.class);
job.setOutputFormat(NullOutputFormat.class);
// Turn off speculative execution
job.setMapSpeculativeExecution(false);
job.setReduceSpeculativeExecution(false);
// Add the job input path
FileInputFormat.addInputPath(job, new Path(this.input_path));
}
示例4: configure
import org.apache.hadoop.mapred.lib.NullOutputFormat; //导入依赖的package包/类
public void configure(JobConf job) {
// Set the mapper and reducers
job.setMapperClass(TestMapper.class);
// job.setReducerClass(TestReducer.class);
// Set the output types of the mapper and reducer
// job.setMapOutputKeyClass(IntWritable.class);
// job.setMapOutputValueClass(NullWritable.class);
// job.setOutputKeyClass(NullWritable.class);
// job.setOutputValueClass(NullWritable.class);
// Make sure this jar is included
job.setJarByClass(TestMapper.class);
// Specify the input and output data formats
job.setInputFormat(TextInputFormat.class);
job.setOutputFormat(NullOutputFormat.class);
// Turn off speculative execution
job.setMapSpeculativeExecution(false);
job.setReduceSpeculativeExecution(false);
// Add the job input path
FileInputFormat.addInputPath(job, new Path(this.input_filename));
}
示例5: runJvmReuseTest
import org.apache.hadoop.mapred.lib.NullOutputFormat; //导入依赖的package包/类
private static void runJvmReuseTest(JobConf job,
boolean reuse) throws IOException {
// setup a map-only job that reads the input and only sets the counters
// based on how many times the jvm was reused.
job.setInt("mapred.job.reuse.jvm.num.tasks", reuse ? -1 : 1);
FileInputFormat.setInputPaths(job, SORT_INPUT_PATH);
job.setInputFormat(SequenceFileInputFormat.class);
job.setOutputFormat(NullOutputFormat.class);
job.setMapperClass(ReuseDetector.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(Text.class);
job.setNumMapTasks(24);
job.setNumReduceTasks(0);
RunningJob result = JobClient.runJob(job);
long uses = result.getCounters().findCounter("jvm", "use").getValue();
int maps = job.getNumMapTasks();
if (reuse) {
assertTrue("maps = " + maps + ", uses = " + uses, maps < uses);
} else {
assertEquals("uses should be number of maps", job.getNumMapTasks(), uses);
}
}
示例6: runTest
import org.apache.hadoop.mapred.lib.NullOutputFormat; //导入依赖的package包/类
private static void runTest(String name, int keylen, int vallen,
int records, int ioSortMB, float recPer, float spillPer,
boolean pedantic) throws Exception {
JobConf conf = new JobConf(new Configuration(), SpillMapper.class);
conf.setInt("io.sort.mb", ioSortMB);
conf.set("io.sort.record.percent", Float.toString(recPer));
conf.set("io.sort.spill.percent", Float.toString(spillPer));
conf.setInt("test.keywritable.length", keylen);
conf.setInt("test.valwritable.length", vallen);
conf.setInt("test.spillmap.records", records);
conf.setBoolean("test.pedantic.verification", pedantic);
conf.setNumMapTasks(1);
conf.setNumReduceTasks(1);
conf.setInputFormat(FakeIF.class);
conf.setOutputFormat(NullOutputFormat.class);
conf.setMapperClass(SpillMapper.class);
conf.setReducerClass(SpillReducer.class);
conf.setMapOutputKeyClass(KeyWritable.class);
conf.setMapOutputValueClass(ValWritable.class);
LOG.info("Running " + name);
JobClient.runJob(conf);
}
示例7: dedup
import org.apache.hadoop.mapred.lib.NullOutputFormat; //导入依赖的package包/类
public void dedup(String solrUrl, boolean noCommit) throws IOException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
long start = System.currentTimeMillis();
LOG.info("SolrDeleteDuplicates: starting at " + sdf.format(start));
LOG.info("SolrDeleteDuplicates: Solr url: " + solrUrl);
JobConf job = new NutchJob(getConf());
job.set(SolrConstants.SERVER_URL, solrUrl);
job.setBoolean("noCommit", noCommit);
job.setInputFormat(SolrInputFormat.class);
job.setOutputFormat(NullOutputFormat.class);
job.setMapOutputKeyClass(Text.class);
job.setMapOutputValueClass(SolrRecord.class);
job.setMapperClass(IdentityMapper.class);
job.setReducerClass(SolrDeleteDuplicates.class);
JobClient.runJob(job);
long end = System.currentTimeMillis();
LOG.info("SolrDeleteDuplicates: finished at " + sdf.format(end) + ", elapsed: " + TimingUtil.elapsedTime(start, end));
}
示例8: delete
import org.apache.hadoop.mapred.lib.NullOutputFormat; //导入依赖的package包/类
public void delete(String crawldb, String solrUrl, boolean noCommit) throws IOException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
long start = System.currentTimeMillis();
LOG.info("SolrClean: starting at " + sdf.format(start));
JobConf job = new NutchJob(getConf());
FileInputFormat.addInputPath(job, new Path(crawldb, CrawlDb.CURRENT_NAME));
job.setBoolean("noCommit", noCommit);
job.set(SolrConstants.SERVER_URL, solrUrl);
job.setInputFormat(SequenceFileInputFormat.class);
job.setOutputFormat(NullOutputFormat.class);
job.setMapOutputKeyClass(ByteWritable.class);
job.setMapOutputValueClass(Text.class);
job.setMapperClass(DBFilter.class);
job.setReducerClass(SolrDeleter.class);
JobClient.runJob(job);
long end = System.currentTimeMillis();
LOG.info("SolrClean: finished at " + sdf.format(end) + ", elapsed: " + TimingUtil.elapsedTime(start, end));
}
示例9: testInputFormat
import org.apache.hadoop.mapred.lib.NullOutputFormat; //导入依赖的package包/类
void testInputFormat(Class<? extends InputFormat> clazz) throws IOException {
Configuration conf = UTIL.getConfiguration();
final JobConf job = new JobConf(conf);
job.setInputFormat(clazz);
job.setOutputFormat(NullOutputFormat.class);
job.setMapperClass(ExampleVerifier.class);
job.setNumReduceTasks(0);
LOG.debug("submitting job.");
final RunningJob run = JobClient.runJob(job);
assertTrue("job failed!", run.isSuccessful());
assertEquals("Saw the wrong number of instances of the filtered-for row.", 2, run.getCounters()
.findCounter(TestTableInputFormat.class.getName() + ":row", "aaa").getCounter());
assertEquals("Saw any instances of the filtered out row.", 0, run.getCounters()
.findCounter(TestTableInputFormat.class.getName() + ":row", "bbb").getCounter());
assertEquals("Saw the wrong number of instances of columnA.", 1, run.getCounters()
.findCounter(TestTableInputFormat.class.getName() + ":family", "columnA").getCounter());
assertEquals("Saw the wrong number of instances of columnB.", 1, run.getCounters()
.findCounter(TestTableInputFormat.class.getName() + ":family", "columnB").getCounter());
assertEquals("Saw the wrong count of values for the filtered-for row.", 2, run.getCounters()
.findCounter(TestTableInputFormat.class.getName() + ":value", "value aaa").getCounter());
assertEquals("Saw the wrong count of values for the filtered-out row.", 0, run.getCounters()
.findCounter(TestTableInputFormat.class.getName() + ":value", "value bbb").getCounter());
}
示例10: configureJob
import org.apache.hadoop.mapred.lib.NullOutputFormat; //导入依赖的package包/类
private void configureJob(JobConf conf) {
conf.setJobName("History");
conf.setInputFormat(TextInputFormat.class);
conf.setMapOutputKeyClass(LongWritable.class);
conf.setMapOutputValueClass(Text.class);
conf.setOutputFormat(NullOutputFormat.class);
conf.setOutputKeyClass(LongWritable.class);
conf.setOutputValueClass(Text.class);
conf.setMapperClass(org.apache.hadoop.mapred.lib.IdentityMapper.class);
conf.setReducerClass(org.apache.hadoop.mapred.lib.IdentityReducer.class);
FileInputFormat.setInputPaths(conf, "/tmp/input");
}
示例11: setupJobConf
import org.apache.hadoop.mapred.lib.NullOutputFormat; //导入依赖的package包/类
public JobConf setupJobConf(int numMapper, int numReducer,
long mapSleepTime, int mapSleepCount,
long reduceSleepTime, int reduceSleepCount) {
JobConf job = new JobConf(getConf(), SleepJob.class);
job.setNumMapTasks(numMapper);
job.setNumReduceTasks(numReducer);
job.setMapperClass(SleepJob.class);
job.setMapOutputKeyClass(IntWritable.class);
job.setMapOutputValueClass(NullWritable.class);
job.setReducerClass(SleepJob.class);
job.setOutputFormat(NullOutputFormat.class);
job.setInputFormat(SleepInputFormat.class);
job.setPartitionerClass(SleepJob.class);
job.setSpeculativeExecution(false);
job.setJobName("Sleep job");
FileInputFormat.addInputPath(job, new Path("ignored"));
job.setLong("sleep.job.map.sleep.time", mapSleepTime);
job.setLong("sleep.job.reduce.sleep.time", reduceSleepTime);
job.setInt("sleep.job.map.sleep.count", mapSleepCount);
job.setInt("sleep.job.reduce.sleep.count", reduceSleepCount);
return job;
}
示例12: runJvmReuseTest
import org.apache.hadoop.mapred.lib.NullOutputFormat; //导入依赖的package包/类
private static void runJvmReuseTest(JobConf job,
boolean reuse) throws IOException {
// setup a map-only job that reads the input and only sets the counters
// based on how many times the jvm was reused.
job.setInt(JobContext.JVM_NUMTASKS_TORUN, reuse ? -1 : 1);
FileInputFormat.setInputPaths(job, SORT_INPUT_PATH);
job.setInputFormat(SequenceFileInputFormat.class);
job.setOutputFormat(NullOutputFormat.class);
job.setMapperClass(ReuseDetector.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(Text.class);
job.setNumMapTasks(24);
job.setNumReduceTasks(0);
RunningJob result = JobClient.runJob(job);
long uses = result.getCounters().findCounter("jvm", "use").getValue();
int maps = job.getNumMapTasks();
if (reuse) {
assertTrue("maps = " + maps + ", uses = " + uses, maps < uses);
} else {
assertEquals("uses should be number of maps", job.getNumMapTasks(), uses);
}
}
示例13: setupJobConf
import org.apache.hadoop.mapred.lib.NullOutputFormat; //导入依赖的package包/类
public JobConf setupJobConf() {
JobConf job = new JobConf(getConf(), MyDummyJob.class);
job.setNumMapTasks(1);
job.setNumReduceTasks(1);
job.setMapperClass(MyDummyJob.class);
job.setMapOutputKeyClass(IntWritable.class);
job.setMapOutputValueClass(NullWritable.class);
job.setReducerClass(MyDummyJob.class);
job.setOutputFormat(NullOutputFormat.class);
job.setInputFormat(EmptyInputFormat.class);
job.setPartitionerClass(MyDummyJob.class);
job.setSpeculativeExecution(false);
job.setJobName("Sleep job");
populateTokens(job);
return job;
}