|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.hadoop.mapreduce.RecordReader<LongWritable,T> org.apache.hadoop.mapreduce.lib.db.DBRecordReader<T>
@InterfaceAudience.Public @InterfaceStability.Evolving public class DBRecordReader<T extends DBWritable>
A RecordReader that reads records from a SQL table. Emits LongWritables containing the record number as key and DBWritables as value.
Field Summary | |
---|---|
protected PreparedStatement |
statement
|
Constructor Summary | |
---|---|
DBRecordReader(org.apache.hadoop.mapreduce.lib.db.DBInputFormat.DBInputSplit split,
Class<T> inputClass,
Configuration conf,
Connection conn,
DBConfiguration dbConfig,
String cond,
String[] fields,
String table)
|
Method Summary | |
---|---|
void |
close()
Close the record reader. |
T |
createValue()
Deprecated. |
protected ResultSet |
executeQuery(String query)
|
protected String |
getConditions()
|
protected Connection |
getConnection()
|
LongWritable |
getCurrentKey()
Get the current key |
T |
getCurrentValue()
Get the current value. |
protected DBConfiguration |
getDBConf()
|
protected String[] |
getFieldNames()
|
long |
getPos()
Deprecated. |
float |
getProgress()
The current progress of the record reader through its data. |
protected String |
getSelectQuery()
Returns the query for selecting the records, subclasses can override this for custom behaviour. |
protected org.apache.hadoop.mapreduce.lib.db.DBInputFormat.DBInputSplit |
getSplit()
|
protected PreparedStatement |
getStatement()
|
protected String |
getTableName()
|
void |
initialize(InputSplit split,
TaskAttemptContext context)
Called once at initialization. |
boolean |
next(LongWritable key,
T value)
Deprecated. Use nextKeyValue() |
boolean |
nextKeyValue()
Read the next key, value pair. |
protected void |
setStatement(PreparedStatement stmt)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected PreparedStatement statement
Constructor Detail |
---|
public DBRecordReader(org.apache.hadoop.mapreduce.lib.db.DBInputFormat.DBInputSplit split, Class<T> inputClass, Configuration conf, Connection conn, DBConfiguration dbConfig, String cond, String[] fields, String table) throws SQLException
split
- The InputSplit to read data for
SQLException
Method Detail |
---|
protected ResultSet executeQuery(String query) throws SQLException
SQLException
protected String getSelectQuery()
public void close() throws IOException
close
in interface Closeable
close
in class RecordReader<LongWritable,T extends DBWritable>
IOException
public void initialize(InputSplit split, TaskAttemptContext context) throws IOException, InterruptedException
RecordReader
initialize
in class RecordReader<LongWritable,T extends DBWritable>
split
- the split that defines the range of records to readcontext
- the information about the task
IOException
InterruptedException
public LongWritable getCurrentKey()
getCurrentKey
in class RecordReader<LongWritable,T extends DBWritable>
public T getCurrentValue()
getCurrentValue
in class RecordReader<LongWritable,T extends DBWritable>
@Deprecated public T createValue()
@Deprecated public long getPos() throws IOException
IOException
@Deprecated public boolean next(LongWritable key, T value) throws IOException
nextKeyValue()
IOException
public float getProgress() throws IOException
getProgress
in class RecordReader<LongWritable,T extends DBWritable>
IOException
public boolean nextKeyValue() throws IOException
nextKeyValue
in class RecordReader<LongWritable,T extends DBWritable>
IOException
protected org.apache.hadoop.mapreduce.lib.db.DBInputFormat.DBInputSplit getSplit()
protected String[] getFieldNames()
protected String getTableName()
protected String getConditions()
protected DBConfiguration getDBConf()
protected Connection getConnection()
protected PreparedStatement getStatement()
protected void setStatement(PreparedStatement stmt)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |