@InterfaceAudience.Public @InterfaceStability.Evolving public class DBRecordReader<T extends DBWritable> extends RecordReader<LongWritable,T>
Modifier and Type | Field and Description |
---|---|
protected PreparedStatement |
statement |
Constructor and Description |
---|
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) |
Modifier and Type | Method and Description |
---|---|
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) |
protected PreparedStatement statement
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 forSQLException
protected ResultSet executeQuery(String query) throws SQLException
SQLException
protected String getSelectQuery()
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
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 taskIOException
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)
Copyright © 2014 Apache Software Foundation. All Rights Reserved.