public class DBRecordReader<T extends DBWritable> extends RecordReader<org.apache.hadoop.io.LongWritable,T>
Constructor and Description |
---|
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) |
Modifier and Type | Method and Description |
---|---|
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) |
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 forjava.sql.SQLException
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 interface java.lang.AutoCloseable
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 taskjava.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)
Copyright © 2009 The Apache Software Foundation