org.apache.hadoop.mapred.lib
Class LazyOutputFormat<K,V>

java.lang.Object
  extended by org.apache.hadoop.mapred.lib.FilterOutputFormat<K,V>
      extended by org.apache.hadoop.mapred.lib.LazyOutputFormat<K,V>
All Implemented Interfaces:
OutputFormat<K,V>

@InterfaceAudience.Public
@InterfaceStability.Stable
public class LazyOutputFormat<K,V>
extends FilterOutputFormat<K,V>

A Convenience class that creates output lazily.


Field Summary
 
Fields inherited from class org.apache.hadoop.mapred.lib.FilterOutputFormat
baseOut
 
Constructor Summary
LazyOutputFormat()
           
 
Method Summary
 void checkOutputSpecs(FileSystem ignored, JobConf job)
          Check for validity of the output-specification for the job.
 RecordWriter<K,V> getRecordWriter(FileSystem ignored, JobConf job, String name, Progressable progress)
          Get the RecordWriter for the given job.
static void setOutputFormatClass(JobConf job, Class<? extends OutputFormat> theClass)
          Set the underlying output format for LazyOutputFormat.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LazyOutputFormat

public LazyOutputFormat()
Method Detail

setOutputFormatClass

public static void setOutputFormatClass(JobConf job,
                                        Class<? extends OutputFormat> theClass)
Set the underlying output format for LazyOutputFormat.

Parameters:
job - the JobConf to modify
theClass - the underlying class

getRecordWriter

public RecordWriter<K,V> getRecordWriter(FileSystem ignored,
                                         JobConf job,
                                         String name,
                                         Progressable progress)
                                  throws IOException
Description copied from interface: OutputFormat
Get the RecordWriter for the given job.

Specified by:
getRecordWriter in interface OutputFormat<K,V>
Overrides:
getRecordWriter in class FilterOutputFormat<K,V>
job - configuration for the job whose output is being written.
name - the unique name for this part of the output.
progress - mechanism for reporting progress while writing to file.
Returns:
a RecordWriter to write the output for the job.
Throws:
IOException

checkOutputSpecs

public void checkOutputSpecs(FileSystem ignored,
                             JobConf job)
                      throws IOException
Description copied from interface: OutputFormat
Check for validity of the output-specification for the job.

This is to validate the output specification for the job when it is a job is submitted. Typically checks that it does not already exist, throwing an exception when it already exists, so that output is not overwritten.

Specified by:
checkOutputSpecs in interface OutputFormat<K,V>
Overrides:
checkOutputSpecs in class FilterOutputFormat<K,V>
job - job configuration.
Throws:
IOException - when output should not be attempted


Copyright © 2014 Apache Software Foundation. All Rights Reserved.