@InterfaceAudience.Public @InterfaceStability.Evolving public class DataDrivenDBInputFormat<T extends DBWritable> extends DBInputFormat<T> implements Configurable
限定符和类型 | 类和说明 |
---|---|
static class |
DataDrivenDBInputFormat.DataDrivenDBInputSplit
A InputSplit that spans a set of rows
|
DBInputFormat.DBInputSplit, DBInputFormat.NullDBWritable
限定符和类型 | 字段和说明 |
---|---|
static String |
SUBSTITUTE_TOKEN
If users are providing their own query, the following string is expected to
appear in the WHERE clause, which will be substituted with a pair of conditions
on the input to allow input splits to parallelise the import.
|
构造器和说明 |
---|
DataDrivenDBInputFormat() |
限定符和类型 | 方法和说明 |
---|---|
protected RecordReader<LongWritable,T> |
createDBRecordReader(DBInputFormat.DBInputSplit split,
Configuration conf) |
protected String |
getBoundingValsQuery() |
List<InputSplit> |
getSplits(JobContext job)
Logically split the set of input files for the job.
|
protected DBSplitter |
getSplitter(int sqlDataType) |
static void |
setBoundingQuery(Configuration conf,
String query)
Set the user-defined bounding query to use with a user-defined query.
|
static void |
setInput(Job job,
Class<? extends DBWritable> inputClass,
String inputQuery,
String inputBoundingQuery)
setInput() takes a custom query and a separate "bounding query" to use
instead of the custom "count query" used by DBInputFormat.
|
static void |
setInput(Job job,
Class<? extends DBWritable> inputClass,
String tableName,
String conditions,
String splitBy,
String... fieldNames)
Note that the "orderBy" column is called the "splitBy" in this version.
|
closeConnection, createRecordReader, getConf, getConnection, getCountQuery, getDBConf, getDBProductName, setConf
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getConf, setConf
protected DBSplitter getSplitter(int sqlDataType)
public List<InputSplit> getSplits(JobContext job) throws IOException
Each InputSplit
is then assigned to an individual Mapper
for processing.
Note: The split is a logical split of the inputs and the
input files are not physically split into chunks. For e.g. a split could
be <input-file-path, start, offset> tuple. The InputFormat
also creates the RecordReader
to read the InputSplit
.
getSplits
在类中 DBInputFormat<T extends DBWritable>
job
- job configuration.InputSplit
s for the job.IOException
protected String getBoundingValsQuery()
public static void setBoundingQuery(Configuration conf, String query)
protected RecordReader<LongWritable,T> createDBRecordReader(DBInputFormat.DBInputSplit split, Configuration conf) throws IOException
createDBRecordReader
在类中 DBInputFormat<T extends DBWritable>
IOException
public static void setInput(Job job, Class<? extends DBWritable> inputClass, String tableName, String conditions, String splitBy, String... fieldNames)
public static void setInput(Job job, Class<? extends DBWritable> inputClass, String inputQuery, String inputBoundingQuery)
Copyright © 2009 The Apache Software Foundation