@InterfaceAudience.Public @InterfaceStability.Evolving public class DBRecordReader<T extends DBWritable> extends RecordReader<org.apache.hadoop.io.LongWritable,T>
| Modifier and Type | Field and Description |
|---|---|
protected PreparedStatement |
statement |
| Constructor and Description |
|---|
DBRecordReader(DBInputFormat.DBInputSplit split,
Class<T> inputClass,
org.apache.hadoop.conf.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() |
org.apache.hadoop.io.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 DBInputFormat.DBInputSplit |
getSplit() |
protected PreparedStatement |
getStatement() |
protected 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(PreparedStatement stmt) |
protected PreparedStatement statement
public DBRecordReader(DBInputFormat.DBInputSplit split, Class<T> inputClass, org.apache.hadoop.conf.Configuration conf, Connection conn, DBConfiguration dbConfig, String cond, String[] fields, String table) throws SQLException
split - The InputSplit to read data forSQLExceptionprotected ResultSet executeQuery(String query) throws SQLException
SQLExceptionprotected String getSelectQuery()
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class RecordReader<org.apache.hadoop.io.LongWritable,T extends DBWritable>IOExceptionpublic void initialize(InputSplit split, TaskAttemptContext context) throws IOException, 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 taskIOExceptionInterruptedExceptionpublic 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 IOException
IOException@Deprecated public boolean next(org.apache.hadoop.io.LongWritable key, T value) throws IOException
nextKeyValue()IOExceptionpublic float getProgress()
throws IOException
getProgress in class RecordReader<org.apache.hadoop.io.LongWritable,T extends DBWritable>IOExceptionpublic boolean nextKeyValue()
throws IOException
nextKeyValue in class RecordReader<org.apache.hadoop.io.LongWritable,T extends DBWritable>IOExceptionprotected 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 © 2022 Apache Software Foundation. All rights reserved.