Package org.apache.hadoop.mapred.lib.db
Class DBOutputFormat<K extends DBWritable,V>
java.lang.Object
org.apache.hadoop.mapreduce.OutputFormat<K,V>
org.apache.hadoop.mapreduce.lib.db.DBOutputFormat<K,V>
org.apache.hadoop.mapred.lib.db.DBOutputFormat<K,V>
- All Implemented Interfaces:
OutputFormat<K,V>
@Public
@Stable
public class DBOutputFormat<K extends DBWritable,V>
extends DBOutputFormat<K,V>
implements OutputFormat<K,V>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classorg.apache.hadoop.mapred.lib.db.DBOutputFormat.DBRecordWriterA RecordWriter that writes the reduce output to a SQL table -
Field Summary
Fields inherited from class org.apache.hadoop.mapreduce.lib.db.DBOutputFormat
dbProductName -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckOutputSpecs(FileSystem filesystem, JobConf job) Check for validity of the output-specification for the job.getRecordWriter(FileSystem filesystem, JobConf job, String name, Progressable progress) Get theRecordWriterfor the given job.static voidInitializes the reduce-part of the job with the appropriate output settingsstatic voidInitializes the reduce-part of the job with the appropriate output settingsMethods inherited from class org.apache.hadoop.mapreduce.lib.db.DBOutputFormat
checkOutputSpecs, constructQuery, getOutputCommitter, getRecordWriter, setOutput, setOutput
-
Constructor Details
-
DBOutputFormat
public DBOutputFormat()
-
-
Method Details
-
checkOutputSpecs
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.
Implementations which write to filesystems which support delegation tokens usually collect the tokens for the destination path(s) and attach them to the job configuration.- Specified by:
checkOutputSpecsin interfaceOutputFormat<K extends DBWritable,V> job- job configuration.- Throws:
IOException- when output should not be attempted
-
getRecordWriter
public RecordWriter<K,V> getRecordWriter(FileSystem filesystem, JobConf job, String name, Progressable progress) throws IOException Get theRecordWriterfor the given job.- Specified by:
getRecordWriterin interfaceOutputFormat<K extends DBWritable,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
RecordWriterto write the output for the job. - Throws:
IOException
-
setOutput
Initializes the reduce-part of the job with the appropriate output settings- Parameters:
job- The jobtableName- The table to insert data intofieldNames- The field names in the table.
-
setOutput
Initializes the reduce-part of the job with the appropriate output settings- Parameters:
job- The jobtableName- The table to insert data intofieldCount- the number of fields in the table.
-