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.SQLExceptionprotected java.sql.ResultSet executeQuery(java.lang.String query)
throws java.sql.SQLException
java.sql.SQLExceptionprotected java.lang.String getSelectQuery()
public void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class RecordReader<org.apache.hadoop.io.LongWritable,T extends DBWritable>java.io.IOExceptionpublic void initialize(InputSplit split, TaskAttemptContext context) throws java.io.IOException, java.lang.InterruptedException
RecordReaderinitialize 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.IOExceptionjava.lang.InterruptedExceptionpublic 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.IOExceptionpublic float getProgress()
throws java.io.IOException
getProgress in class RecordReader<org.apache.hadoop.io.LongWritable,T extends DBWritable>java.io.IOExceptionpublic boolean nextKeyValue()
throws java.io.IOException
nextKeyValue in class RecordReader<org.apache.hadoop.io.LongWritable,T extends DBWritable>java.io.IOExceptionprotected 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