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